model_fields_entity.go 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // ==========================================================================
  2. // This is auto-generated by gf cli tool. You may not really want to edit it.
  3. // ==========================================================================
  4. package model_fields
  5. import (
  6. "database/sql"
  7. "github.com/gogf/gf/database/gdb"
  8. )
  9. // Entity is the golang structure for table model_fields.
  10. type Entity struct {
  11. FieldId uint64 `orm:"field_id,primary" json:"field_id"` // 模型字段ID
  12. ModelId uint `orm:"model_id" json:"model_id"` // 模型ID
  13. FieldName string `orm:"field_name" json:"field_name"` // 字段名称
  14. FieldTitle string `orm:"field_title" json:"field_title"` // 字段标题
  15. FieldType string `orm:"field_type" json:"field_type"` // 字段类型
  16. FieldLength string `orm:"field_length" json:"field_length"` // 字段长度
  17. FieldDefault string `orm:"field_default" json:"field_default"` // 字段默认值
  18. FieldData string `orm:"field_data" json:"field_data"` // 字段数据
  19. FieldDesc string `orm:"field_desc" json:"field_desc"` // 字段描述
  20. FieldRules string `orm:"field_rules" json:"field_rules"` // 字段规则
  21. FieldSort int64 `orm:"field_sort" json:"field_sort"` // 字段排序
  22. FieldWidth string `orm:"field_width" json:"field_width"` // 字段列表显示宽度
  23. FieldAlign string `orm:"field_align" json:"field_align"` // 字段列表对齐
  24. CreateBy uint64 `orm:"create_by" json:"create_by"` // 创建人
  25. UpdateBy uint64 `orm:"update_by" json:"update_by"` // 修改人
  26. CreateTime uint64 `orm:"create_time" json:"create_time"` // 创建时间
  27. UpdateTime uint64 `orm:"update_time" json:"update_time"` // 修改时间
  28. }
  29. // OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
  30. // the data and where attributes for empty values.
  31. func (r *Entity) OmitEmpty() *arModel {
  32. return Model.Data(r).OmitEmpty()
  33. }
  34. // Inserts does "INSERT...INTO..." statement for inserting current object into table.
  35. func (r *Entity) Insert() (result sql.Result, err error) {
  36. return Model.Data(r).Insert()
  37. }
  38. // InsertIgnore does "INSERT IGNORE INTO ..." statement for inserting current object into table.
  39. func (r *Entity) InsertIgnore() (result sql.Result, err error) {
  40. return Model.Data(r).InsertIgnore()
  41. }
  42. // Replace does "REPLACE...INTO..." statement for inserting current object into table.
  43. // If there's already another same record in the table (it checks using primary key or unique index),
  44. // it deletes it and insert this one.
  45. func (r *Entity) Replace() (result sql.Result, err error) {
  46. return Model.Data(r).Replace()
  47. }
  48. // Save does "INSERT...INTO..." statement for inserting/updating current object into table.
  49. // It updates the record if there's already another same record in the table
  50. // (it checks using primary key or unique index).
  51. func (r *Entity) Save() (result sql.Result, err error) {
  52. return Model.Data(r).Save()
  53. }
  54. // Update does "UPDATE...WHERE..." statement for updating current object from table.
  55. // It updates the record if there's already another same record in the table
  56. // (it checks using primary key or unique index).
  57. func (r *Entity) Update() (result sql.Result, err error) {
  58. return Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()
  59. }
  60. // Delete does "DELETE FROM...WHERE..." statement for deleting current object from table.
  61. func (r *Entity) Delete() (result sql.Result, err error) {
  62. return Model.Where(gdb.GetWhereConditionOfStruct(r)).Delete()
  63. }