// AddRule adds a rule into mapping
AddRule adds a rule into mapping
// AddRule adds a rule into mapping
func (m *Mapping) AddRule(rule *Rule) error {
	err := rule.Valid()
	if err != nil {
		return errors.Trace(err)
	}
	m.resetCache()
	err = m.Insert(rule.PatternSchema, rule.PatternTable, rule, false)
	if err != nil {
		return errors.Annotatef(err, "add rule %+v into mapping", rule)
	}
	return nil
}
func ( m * Mapping ) AddRule ( rule * Rule ) error { err := rule . Valid ( ) if err != nil { return errors . Trace ( err ) } m . resetCache ( ) err = m . Insert ( rule . PatternSchema , rule . PatternTable , rule , false ) if err != nil { return errors . Annotatef ( err , " " , rule ) } return nil }
AddRule adds a rule into mapping
AddRule adds a rule into mapping