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

package wf_run_cache

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

// Entity is the golang structure for table wf_run_cache.
type Entity struct {
	Id             uint   `orm:"id,primary"       json:"id"`               //
	RunId          uint   `orm:"run_id"           json:"run_id"`           // 缓存run工作的全部流程模板步骤等信息,确保修改流程后工作依然不变
	FormId         uint   `orm:"form_id"          json:"form_id"`          //
	FlowId         uint   `orm:"flow_id"          json:"flow_id"`          // 流程ID
	RunForm        string `orm:"run_form"         json:"run_form"`         // 模板信息
	RunFlow        string `orm:"run_flow"         json:"run_flow"`         // 流程信息
	RunFlowProcess string `orm:"run_flow_process" json:"run_flow_process"` // 流程步骤信息
	IsDel          uint   `orm:"is_del"           json:"is_del"`           //
	Updatetime     uint   `orm:"updatetime"       json:"updatetime"`       //
	Dateline       uint   `orm:"dateline"         json:"dateline"`         //
}

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