Example #1
0
func NUpdate(this *NewemployeeCatalog) error {
	if this.Id == 0 {
		return fmt.Errorf("primary key id not set")
	}
	_, err := orm.NewOrm().Update(this)
	if err == nil {
		g.NCatalogCacheDel(fmt.Sprintf("%d", this.Id))
	}
	return err
}
Example #2
0
func NDel(c *NewemployeeCatalog) error {
	num, err := orm.NewOrm().Delete(c)
	if err != nil {
		return err
	}

	if num > 0 {
		g.NCatalogCacheDel("ids")
	}
	return nil
}
Example #3
0
func NSave(this *NewemployeeCatalog) (int64, error) {
	if NIdentExists(this.Ident) {
		return 0, fmt.Errorf("catalog english identity exists")
	}
	num, err := orm.NewOrm().Insert(this)
	if err == nil {
		g.NCatalogCacheDel("ids")
	}

	return num, err
}