// ==========================================================================
// This is auto-generated by gf cli tool. You may not really want to edit it.
// ==========================================================================

package plug_link

import (
	"database/sql"
	"github.com/gogf/gf/database/gdb"
)

// Entity is the golang structure for table plug_link.
type Entity struct {
	LinkId       int    `orm:"link_id,primary" json:"link_id"`      //
	LinkName     string `orm:"link_name"       json:"link_name"`    // 链接名称
	LinkUrl      string `orm:"link_url"        json:"link_url"`     // 链接URL
	LinkTarget   string `orm:"link_target"     json:"link_target"`  // 打开方式
	LinkTypeid   int    `orm:"link_typeid"     json:"link_typeid"`  // 所属栏目ID
	LinkQq       string `orm:"link_qq"         json:"link_qq"`      // 联系QQ
	LinkOrder    int64  `orm:"link_order"      json:"link_order"`   // 排序
	LinkAddtime  int    `orm:"link_addtime"    json:"link_addtime"` // 添加时间
	LinkOpen     int    `orm:"link_open"       json:"link_open"`    // 0禁用1启用
	LinkUsername string `orm:"link_username" json:"link_username"`  // 申请友情链接的联系人
	LinkEmail    string `orm:"link_email" json:"link_email"`        // 联系邮箱
	LinkRemark   string `orm:"link_remark" json:"link_remark"`      // 申请友情链接时的备注
}

// 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()
}
