Files
2020-07-14 10:50:11 +08:00

68 lines
2.9 KiB
Go

// ==========================================================================
// This is auto-generated by gf cli tool. You may not really want to edit it.
// ==========================================================================
package plug_ad
import (
"database/sql"
"github.com/gogf/gf/database/gdb"
)
// Entity is the golang structure for table plug_ad.
type Entity struct {
AdId int `orm:"ad_id,primary" json:"ad_id"` //
AdName string `orm:"ad_name" json:"ad_name"` // 广告名称
AdAdtypeid int `orm:"ad_adtypeid" json:"ad_adtypeid"` // 所属位置
AdCheckid int `orm:"ad_checkid" json:"ad_checkid"` // 1=图片 2=JS
AdJs string `orm:"ad_js" json:"ad_js"` // JS代码
AdPic string `orm:"ad_pic" json:"ad_pic"` // 广告图片URL
AdUrl string `orm:"ad_url" json:"ad_url"` // 广告链接
AdContent string `orm:"ad_content" json:"ad_content"` // 广告文字内容
AdAddtime int `orm:"ad_addtime" json:"ad_addtime"` // 添加时间
AdSort int `orm:"ad_sort" json:"ad_sort"` // 排序
AdOpen int `orm:"ad_open" json:"ad_open"` // 1=审核 0=未审核
}
// OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
// the data and where attributes for empty values.
func (r *Entity) OmitEmpty() *arModel {
return Model.Data(r).OmitEmpty()
}
// Inserts does "INSERT...INTO..." statement for inserting current object into table.
func (r *Entity) Insert() (result sql.Result, err error) {
return Model.Data(r).Insert()
}
// InsertIgnore does "INSERT IGNORE INTO ..." statement for inserting current object into table.
func (r *Entity) InsertIgnore() (result sql.Result, err error) {
return Model.Data(r).InsertIgnore()
}
// Replace does "REPLACE...INTO..." statement for inserting current object into table.
// If there's already another same record in the table (it checks using primary key or unique index),
// it deletes it and insert this one.
func (r *Entity) Replace() (result sql.Result, err error) {
return Model.Data(r).Replace()
}
// Save does "INSERT...INTO..." statement for inserting/updating current object into table.
// It updates the record if there's already another same record in the table
// (it checks using primary key or unique index).
func (r *Entity) Save() (result sql.Result, err error) {
return Model.Data(r).Save()
}
// Update does "UPDATE...WHERE..." statement for updating current object from table.
// It updates the record if there's already another same record in the table
// (it checks using primary key or unique index).
func (r *Entity) Update() (result sql.Result, err error) {
return Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()
}
// Delete does "DELETE FROM...WHERE..." statement for deleting current object from table.
func (r *Entity) Delete() (result sql.Result, err error) {
return Model.Where(gdb.GetWhereConditionOfStruct(r)).Delete()
}