sys_config_entity.go 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // ==========================================================================
  2. // This is auto-generated by gf cli tool. You may not really want to edit it.
  3. // ==========================================================================
  4. package sys_config
  5. import (
  6. "database/sql"
  7. "github.com/gogf/gf/database/gdb"
  8. )
  9. // Entity is the golang structure for table sys_config.
  10. type Entity struct {
  11. ConfigId uint `orm:"config_id,primary" json:"config_id"` // 参数主键
  12. ConfigName string `orm:"config_name" json:"config_name"` // 参数名称
  13. ConfigKey string `orm:"config_key" json:"config_key"` // 参数键名
  14. ConfigValue string `orm:"config_value" json:"config_value"` // 参数键值
  15. ConfigType int `orm:"config_type" json:"config_type"` // 系统内置(Y是 N否)
  16. CreateBy uint `orm:"create_by" json:"create_by"` // 创建者
  17. CreateTime uint64 `orm:"create_time" json:"create_time"` // 创建时间
  18. UpdateBy uint `orm:"update_by" json:"update_by"` // 更新者
  19. UpdateTime uint64 `orm:"update_time" json:"update_time"` // 更新时间
  20. Remark string `orm:"remark" json:"remark"` // 备注
  21. }
  22. // OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
  23. // the data and where attributes for empty values.
  24. func (r *Entity) OmitEmpty() *arModel {
  25. return Model.Data(r).OmitEmpty()
  26. }
  27. // Inserts does "INSERT...INTO..." statement for inserting current object into table.
  28. func (r *Entity) Insert() (result sql.Result, err error) {
  29. return Model.Data(r).Insert()
  30. }
  31. // Replace does "REPLACE...INTO..." statement for inserting current object into table.
  32. // If there's already another same record in the table (it checks using primary key or unique index),
  33. // it deletes it and insert this one.
  34. func (r *Entity) Replace() (result sql.Result, err error) {
  35. return Model.Data(r).Replace()
  36. }
  37. // Save does "INSERT...INTO..." statement for inserting/updating current object into table.
  38. // It updates the record if there's already another same record in the table
  39. // (it checks using primary key or unique index).
  40. func (r *Entity) Save() (result sql.Result, err error) {
  41. return Model.Data(r).Save()
  42. }
  43. // Update does "UPDATE...WHERE..." statement for updating current object from table.
  44. // It updates the record if there's already another same record in the table
  45. // (it checks using primary key or unique index).
  46. func (r *Entity) Update() (result sql.Result, err error) {
  47. return Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()
  48. }
  49. // Delete does "DELETE FROM...WHERE..." statement for deleting current object from table.
  50. func (r *Entity) Delete() (result sql.Result, err error) {
  51. return Model.Where(gdb.GetWhereConditionOfStruct(r)).Delete()
  52. }