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

package blog_classification

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

// Entity is the golang structure for table blog_classification.
type Entity struct {
	ClassificationId       uint   `orm:"classification_id,primary" json:"classification_id"`       //
	ClassificationName     string `orm:"classification_name"       json:"classification_name"`     // 分类名称
	ClassificationPid      uint   `orm:"classification_pid"        json:"classification_pid"`      // 分类父id
	ClassificationSort     uint   `orm:"classification_sort"       json:"classification_sort"`     // 排序
	ClassificationType     uint   `orm:"classification_type"       json:"classification_type"`     // 分类类型1.频道页/2.发布栏目/3.跳转栏目/4.单页栏目
	ClassificationDescribe string `orm:"classification_describe"   json:"classification_describe"` // 分类描述
	ClassificationStatus   uint   `orm:"classification_status"     json:"classification_status"`   // 分类状态,0停用,1正常
	ClassificationAddress  string `orm:"classification_address" json:"classification_address"`     // 跳转栏目的跳转地址
	ClassificationContent  string `orm:"classification_content" json:"classification_content"`     // 单页栏目的内容
}

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