From eaf41b55aaef6528b0f4e436841de241aef3a0f0 Mon Sep 17 00:00:00 2001 From: shoopea Date: Mon, 6 Jan 2020 12:05:00 +0800 Subject: [PATCH] update rules --- sql.go | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) diff --git a/sql.go b/sql.go index 27e79ee..7644abc 100644 --- a/sql.go +++ b/sql.go @@ -781,52 +781,6 @@ func insertMsgPillageInc(m *ChatWarsMessagePillageInc) error { return nil } -func loadMsgParsingRules() (m map[int]MessageParsingRule, err error) { - var ( - id int32 - priority int32 - descn string - rule string - msgTypeID64 int64 - ) - - log.Println("Loading message parsing rules...") - m = make(map[int]MessageParsingRule) - count := int(0) - - defer func() { - if rec := recover(); rec != nil { - log.Println("Error parsing rules : ", rec) - err = errors.New("panic") - } - }() - - rules, err := db.Query(`SELECT r.id, r.prio, r.descn, r.rule, r.msg_type_id FROM msg_rules r ORDER BY r.prio DESC;`) - if err != nil { - return m, err - } - defer rules.Close() - - for rules.Next() { - err = rules.Scan(&id, &priority, &descn, &rule, &msgTypeID64) - if err != nil { - return m, err - } - i := new(MessageParsingRule) - i.ID = id - i.Priority = priority - i.Description = descn - i.Rule = rule - i.MsgTypeID64 = msgTypeID64 - i.re = regexp.MustCompile(rule) - m[count] = *i - // log.Printf("New rule : %s\n", rule) - count++ - } - - return m, nil -} - func getSQLListID64(q string) []int64 { var ( id int64