(strategy_id int)
| 88 | } |
| 89 | |
| 90 | func (this *db) GetTriggersByStrategyID(strategy_id int) map[string]*types.Trigger { |
| 91 | rows, err := this.Query("SELECT `id`, `strategy_id`, `metric`, `tags`, `number`, `index`, `method`, `symbol`, `threshold`, `description` FROM `trigger` WHERE `strategy_id` = ?", strategy_id) |
| 92 | if err != nil { |
| 93 | lg.Error(err.Error()) |
| 94 | return nil |
| 95 | } |
| 96 | defer rows.Close() |
| 97 | triggers := make(map[string]*types.Trigger) |
| 98 | for rows.Next() { |
| 99 | trigger := types.Trigger{} |
| 100 | if err := rows.Scan(&trigger.ID, &trigger.StrategyID, &trigger.Metric, &trigger.Tags, &trigger.Number, &trigger.Index, &trigger.Method, &trigger.Symbol, &trigger.Threshold, &trigger.Description); err != nil { |
| 101 | lg.Error(err.Error()) |
| 102 | continue |
| 103 | } |
| 104 | triggers[trigger.Index] = &trigger |
| 105 | } |
| 106 | return triggers |
| 107 | } |
| 108 | |
| 109 | func (this *db) GetActions(strategy_id, action_type int) []*types.Action { |
| 110 | actions := []*types.Action{} |
no test coverage detected