ctr_contract_share.go 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697
  1. // ==========================================================================
  2. // This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
  3. // ==========================================================================
  4. package internal
  5. import (
  6. "context"
  7. "database/sql"
  8. "github.com/gogf/gf/database/gdb"
  9. "github.com/gogf/gf/frame/g"
  10. "github.com/gogf/gf/frame/gmvc"
  11. "time"
  12. model "dashoo.cn/micro/app/model/contract"
  13. )
  14. // CtrContractShareDao is the manager for logic model data accessing and custom defined data operations functions management.
  15. type CtrContractShareDao struct {
  16. gmvc.M // M is the core and embedded struct that inherits all chaining operations from gdb.Model.
  17. C ctrContractShareColumns // C is the short type for Columns, which contains all the column names of Table for convenient usage.
  18. DB gdb.DB // DB is the raw underlying database management object.
  19. Table string // Table is the underlying table name of the DAO.
  20. TableAs string // TableAs is the underlying table alias name of the DAO.
  21. }
  22. // CtrContractShareColumns defines and stores column names for table ctr_contract_share.
  23. type ctrContractShareColumns struct {
  24. Id string // 主键
  25. ContractId string // 关联合同
  26. ContractCode string // 合同编号
  27. ContractAmount string // 合同金额
  28. ContractSignTime string // 合同签订时间(提高统计效率,此处没有连表查询)
  29. SaleId string // 归属销售
  30. SaleName string // 销售姓名
  31. ShareRatio string // 销售分成比例
  32. ShareAmount string // 销售分成金额
  33. Remark string // 备注
  34. CreatedBy string // 创建者
  35. CreatedName string // 创建人
  36. CreatedTime string // 创建时间
  37. UpdatedBy string // 更新者
  38. UpdatedName string // 更新人
  39. UpdatedTime string // 更新时间
  40. DeletedTime string // 删除时间
  41. }
  42. var (
  43. // CtrContractShare is globally public accessible object for table ctr_contract_share operations.
  44. CtrContractShare = CtrContractShareDao{
  45. M: g.DB("default").Model("ctr_contract_share").Safe(),
  46. DB: g.DB("default"),
  47. Table: "ctr_contract_share",
  48. C: ctrContractShareColumns{
  49. Id: "id",
  50. ContractId: "contract_id",
  51. ContractCode: "contract_code",
  52. ContractAmount: "contract_amount",
  53. ContractSignTime: "contract_sign_time",
  54. SaleId: "sale_id",
  55. SaleName: "sale_name",
  56. ShareRatio: "share_ratio",
  57. ShareAmount: "share_amount",
  58. Remark: "remark",
  59. CreatedBy: "created_by",
  60. CreatedName: "created_name",
  61. CreatedTime: "created_time",
  62. UpdatedBy: "updated_by",
  63. UpdatedName: "updated_name",
  64. UpdatedTime: "updated_time",
  65. DeletedTime: "deleted_time",
  66. },
  67. }
  68. )
  69. func NewCtrContractShareDao(tenant string) CtrContractShareDao {
  70. var dao CtrContractShareDao
  71. dao = CtrContractShareDao{
  72. M: g.DB(tenant).Model("ctr_contract_share").Safe(),
  73. DB: g.DB(tenant),
  74. Table: "ctr_contract_share",
  75. C: ctrContractShareColumns{
  76. Id: "id",
  77. ContractId: "contract_id",
  78. ContractCode: "contract_code",
  79. ContractAmount: "contract_amount",
  80. ContractSignTime: "contract_sign_time",
  81. SaleId: "sale_id",
  82. SaleName: "sale_name",
  83. ShareRatio: "share_ratio",
  84. ShareAmount: "share_amount",
  85. Remark: "remark",
  86. CreatedBy: "created_by",
  87. CreatedName: "created_name",
  88. CreatedTime: "created_time",
  89. UpdatedBy: "updated_by",
  90. UpdatedName: "updated_name",
  91. UpdatedTime: "updated_time",
  92. DeletedTime: "deleted_time",
  93. },
  94. }
  95. return dao
  96. }
  97. // Ctx is a chaining function, which creates and returns a new DB that is a shallow copy
  98. // of current DB object and with given context in it.
  99. // Note that this returned DB object can be used only once, so do not assign it to
  100. // a global or package variable for long using.
  101. func (d *CtrContractShareDao) Ctx(ctx context.Context) *CtrContractShareDao {
  102. return &CtrContractShareDao{M: d.M.Ctx(ctx), Table: d.Table, TableAs: d.TableAs}
  103. }
  104. // GetCtx returns the context for current Model.
  105. // It returns "context.Background() i"s there's no context previously set.
  106. func (d *CtrContractShareDao) GetCtx() context.Context {
  107. return d.M.GetCtx()
  108. }
  109. // As sets an alias name for current table.
  110. func (d *CtrContractShareDao) As(as string) *CtrContractShareDao {
  111. return &CtrContractShareDao{M: d.M.As(as), Table: d.Table, TableAs: as}
  112. }
  113. // TX sets the transaction for current operation.
  114. func (d *CtrContractShareDao) TX(tx *gdb.TX) *CtrContractShareDao {
  115. return &CtrContractShareDao{M: d.M.TX(tx), Table: d.Table, TableAs: d.TableAs}
  116. }
  117. // Master marks the following operation on master node.
  118. func (d *CtrContractShareDao) Master() *CtrContractShareDao {
  119. return &CtrContractShareDao{M: d.M.Master(), Table: d.Table, TableAs: d.TableAs}
  120. }
  121. // Slave marks the following operation on slave node.
  122. // Note that it makes sense only if there's any slave node configured.
  123. func (d *CtrContractShareDao) Slave() *CtrContractShareDao {
  124. return &CtrContractShareDao{M: d.M.Slave(), Table: d.Table, TableAs: d.TableAs}
  125. }
  126. // Args sets custom arguments for model operation.
  127. func (d *CtrContractShareDao) Args(args ...interface{}) *CtrContractShareDao {
  128. return &CtrContractShareDao{M: d.M.Args(args...), Table: d.Table, TableAs: d.TableAs}
  129. }
  130. // Handler calls each of "handlers" on current Model and returns a new Model.
  131. // ModelHandler is a function that handles given Model and returns a new Model that is custom modified.
  132. func (d *CtrContractShareDao) Handler(handlers ...gdb.ModelHandler) *CtrContractShareDao {
  133. return &CtrContractShareDao{M: d.M.Handler(handlers...), Table: d.Table, TableAs: d.TableAs}
  134. }
  135. // LeftJoin does "LEFT JOIN ... ON ..." statement on the model.
  136. // The parameter <table> can be joined table and its joined condition,
  137. // and also with its alias name, like:
  138. // Table("user").LeftJoin("user_detail", "user_detail.uid=user.uid")
  139. // Table("user", "u").LeftJoin("user_detail", "ud", "ud.uid=u.uid")
  140. func (d *CtrContractShareDao) LeftJoin(table ...string) *CtrContractShareDao {
  141. return &CtrContractShareDao{M: d.M.LeftJoin(table...), Table: d.Table, TableAs: d.TableAs}
  142. }
  143. // RightJoin does "RIGHT JOIN ... ON ..." statement on the model.
  144. // The parameter <table> can be joined table and its joined condition,
  145. // and also with its alias name, like:
  146. // Table("user").RightJoin("user_detail", "user_detail.uid=user.uid")
  147. // Table("user", "u").RightJoin("user_detail", "ud", "ud.uid=u.uid")
  148. func (d *CtrContractShareDao) RightJoin(table ...string) *CtrContractShareDao {
  149. return &CtrContractShareDao{M: d.M.RightJoin(table...), Table: d.Table, TableAs: d.TableAs}
  150. }
  151. // InnerJoin does "INNER JOIN ... ON ..." statement on the model.
  152. // The parameter <table> can be joined table and its joined condition,
  153. // and also with its alias name, like:
  154. // Table("user").InnerJoin("user_detail", "user_detail.uid=user.uid")
  155. // Table("user", "u").InnerJoin("user_detail", "ud", "ud.uid=u.uid")
  156. func (d *CtrContractShareDao) InnerJoin(table ...string) *CtrContractShareDao {
  157. return &CtrContractShareDao{M: d.M.InnerJoin(table...), Table: d.Table, TableAs: d.TableAs}
  158. }
  159. // Fields sets the operation fields of the model, multiple fields joined using char ','.
  160. // The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
  161. func (d *CtrContractShareDao) Fields(fieldNamesOrMapStruct ...interface{}) *CtrContractShareDao {
  162. return &CtrContractShareDao{M: d.M.Fields(fieldNamesOrMapStruct...), Table: d.Table, TableAs: d.TableAs}
  163. }
  164. // FieldsEx sets the excluded operation fields of the model, multiple fields joined using char ','.
  165. // The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
  166. func (d *CtrContractShareDao) FieldsEx(fieldNamesOrMapStruct ...interface{}) *CtrContractShareDao {
  167. return &CtrContractShareDao{M: d.M.FieldsEx(fieldNamesOrMapStruct...), Table: d.Table, TableAs: d.TableAs}
  168. }
  169. // FieldCount formats and appends commonly used field "COUNT(column)" to the select fields of model.
  170. func (d *CtrContractShareDao) FieldCount(column string, as ...string) *CtrContractShareDao {
  171. return &CtrContractShareDao{M: d.M.FieldCount(column, as...), Table: d.Table, TableAs: d.TableAs}
  172. }
  173. // FieldSum formats and appends commonly used field "SUM(column)" to the select fields of model.
  174. func (d *CtrContractShareDao) FieldSum(column string, as ...string) *CtrContractShareDao {
  175. return &CtrContractShareDao{M: d.M.FieldSum(column, as...), Table: d.Table, TableAs: d.TableAs}
  176. }
  177. // FieldMin formats and appends commonly used field "MIN(column)" to the select fields of model.
  178. func (d *CtrContractShareDao) FieldMin(column string, as ...string) *CtrContractShareDao {
  179. return &CtrContractShareDao{M: d.M.FieldMin(column, as...), Table: d.Table, TableAs: d.TableAs}
  180. }
  181. // FieldMax formats and appends commonly used field "MAX(column)" to the select fields of model.
  182. func (d *CtrContractShareDao) FieldMax(column string, as ...string) *CtrContractShareDao {
  183. return &CtrContractShareDao{M: d.M.FieldMax(column, as...), Table: d.Table, TableAs: d.TableAs}
  184. }
  185. // FieldAvg formats and appends commonly used field "AVG(column)" to the select fields of model.
  186. func (d *CtrContractShareDao) FieldAvg(column string, as ...string) *CtrContractShareDao {
  187. return &CtrContractShareDao{M: d.M.FieldAvg(column, as...), Table: d.Table, TableAs: d.TableAs}
  188. }
  189. // Option adds extra operation option for the model.
  190. // Deprecated, use separate operations instead.
  191. func (d *CtrContractShareDao) Option(option int) *CtrContractShareDao {
  192. return &CtrContractShareDao{M: d.M.Option(option), Table: d.Table, TableAs: d.TableAs}
  193. }
  194. // OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
  195. // the data and where attributes for empty values.
  196. func (d *CtrContractShareDao) OmitEmpty() *CtrContractShareDao {
  197. return &CtrContractShareDao{M: d.M.OmitEmpty(), Table: d.Table, TableAs: d.TableAs}
  198. }
  199. // OmitEmptyWhere sets optionOmitEmptyWhere option for the model, which automatically filers
  200. // the Where/Having parameters for "empty" values.
  201. func (d *CtrContractShareDao) OmitEmptyWhere() *CtrContractShareDao {
  202. return &CtrContractShareDao{M: d.M.OmitEmptyWhere(), Table: d.Table, TableAs: d.TableAs}
  203. }
  204. // OmitEmptyData sets optionOmitEmptyData option for the model, which automatically filers
  205. // the Data parameters for "empty" values.
  206. func (d *CtrContractShareDao) OmitEmptyData() *CtrContractShareDao {
  207. return &CtrContractShareDao{M: d.M.OmitEmptyData(), Table: d.Table, TableAs: d.TableAs}
  208. }
  209. // OmitNil sets optionOmitNil option for the model, which automatically filers
  210. // the data and where parameters for "nil" values.
  211. func (d *CtrContractShareDao) OmitNil() *CtrContractShareDao {
  212. return &CtrContractShareDao{M: d.M.OmitNil(), Table: d.Table, TableAs: d.TableAs}
  213. }
  214. // OmitNilWhere sets optionOmitNilWhere option for the model, which automatically filers
  215. // the Where/Having parameters for "nil" values.
  216. func (d *CtrContractShareDao) OmitNilWhere() *CtrContractShareDao {
  217. return &CtrContractShareDao{M: d.M.OmitNilWhere(), Table: d.Table, TableAs: d.TableAs}
  218. }
  219. // OmitNilData sets optionOmitNilData option for the model, which automatically filers
  220. // the Data parameters for "nil" values.
  221. func (d *CtrContractShareDao) OmitNilData() *CtrContractShareDao {
  222. return &CtrContractShareDao{M: d.M.OmitNilData(), Table: d.Table, TableAs: d.TableAs}
  223. }
  224. // Filter marks filtering the fields which does not exist in the fields of the operated table.
  225. // Note that this function supports only single table operations.
  226. // Deprecated, filter feature is automatically enabled from GoFrame v1.16.0, it is so no longer used.
  227. func (d *CtrContractShareDao) Filter() *CtrContractShareDao {
  228. return &CtrContractShareDao{M: d.M.Filter(), Table: d.Table, TableAs: d.TableAs}
  229. }
  230. // Where sets the condition statement for the model. The parameter <where> can be type of
  231. // string/map/gmap/slice/struct/*struct, etc. Note that, if it's called more than one times,
  232. // multiple conditions will be joined into where statement using "AND".
  233. // Eg:
  234. // Where("uid=10000")
  235. // Where("uid", 10000)
  236. // Where("money>? AND name like ?", 99999, "vip_%")
  237. // Where("uid", 1).Where("name", "john")
  238. // Where("status IN (?)", g.Slice{1,2,3})
  239. // Where("age IN(?,?)", 18, 50)
  240. // Where(User{ Id : 1, UserName : "john"})
  241. func (d *CtrContractShareDao) Where(where interface{}, args ...interface{}) *CtrContractShareDao {
  242. return &CtrContractShareDao{M: d.M.Where(where, args...), Table: d.Table, TableAs: d.TableAs}
  243. }
  244. // WherePri does the same logic as M.Where except that if the parameter <where>
  245. // is a single condition like int/string/float/slice, it treats the condition as the primary
  246. // key value. That is, if primary key is "id" and given <where> parameter as "123", the
  247. // WherePri function treats the condition as "id=123", but M.Where treats the condition
  248. // as string "123".
  249. func (d *CtrContractShareDao) WherePri(where interface{}, args ...interface{}) *CtrContractShareDao {
  250. return &CtrContractShareDao{M: d.M.WherePri(where, args...), Table: d.Table, TableAs: d.TableAs}
  251. }
  252. // Having sets the having statement for the model.
  253. // The parameters of this function usage are as the same as function Where.
  254. // See Where.
  255. func (d *CtrContractShareDao) Having(having interface{}, args ...interface{}) *CtrContractShareDao {
  256. return &CtrContractShareDao{M: d.M.Having(having, args...), Table: d.Table, TableAs: d.TableAs}
  257. }
  258. // Wheref builds condition string using fmt.Sprintf and arguments.
  259. // Note that if the number of "args" is more than the place holder in "format",
  260. // the extra "args" will be used as the where condition arguments of the Model.
  261. func (d *CtrContractShareDao) Wheref(format string, args ...interface{}) *CtrContractShareDao {
  262. return &CtrContractShareDao{M: d.M.Wheref(format, args...), Table: d.Table, TableAs: d.TableAs}
  263. }
  264. // WhereLT builds "column < value" statement.
  265. func (d *CtrContractShareDao) WhereLT(column string, value interface{}) *CtrContractShareDao {
  266. return &CtrContractShareDao{M: d.M.WhereLT(column, value), Table: d.Table, TableAs: d.TableAs}
  267. }
  268. // WhereLTE builds "column <= value" statement.
  269. func (d *CtrContractShareDao) WhereLTE(column string, value interface{}) *CtrContractShareDao {
  270. return &CtrContractShareDao{M: d.M.WhereLTE(column, value), Table: d.Table, TableAs: d.TableAs}
  271. }
  272. // WhereGT builds "column > value" statement.
  273. func (d *CtrContractShareDao) WhereGT(column string, value interface{}) *CtrContractShareDao {
  274. return &CtrContractShareDao{M: d.M.WhereGT(column, value), Table: d.Table, TableAs: d.TableAs}
  275. }
  276. // WhereGTE builds "column >= value" statement.
  277. func (d *CtrContractShareDao) WhereGTE(column string, value interface{}) *CtrContractShareDao {
  278. return &CtrContractShareDao{M: d.M.WhereGTE(column, value), Table: d.Table, TableAs: d.TableAs}
  279. }
  280. // WhereBetween builds "column BETWEEN min AND max" statement.
  281. func (d *CtrContractShareDao) WhereBetween(column string, min, max interface{}) *CtrContractShareDao {
  282. return &CtrContractShareDao{M: d.M.WhereBetween(column, min, max), Table: d.Table, TableAs: d.TableAs}
  283. }
  284. // WhereLike builds "column LIKE like" statement.
  285. func (d *CtrContractShareDao) WhereLike(column string, like interface{}) *CtrContractShareDao {
  286. return &CtrContractShareDao{M: d.M.WhereLike(column, like), Table: d.Table, TableAs: d.TableAs}
  287. }
  288. // WhereIn builds "column IN (in)" statement.
  289. func (d *CtrContractShareDao) WhereIn(column string, in interface{}) *CtrContractShareDao {
  290. return &CtrContractShareDao{M: d.M.WhereIn(column, in), Table: d.Table, TableAs: d.TableAs}
  291. }
  292. // WhereNull builds "columns[0] IS NULL AND columns[1] IS NULL ..." statement.
  293. func (d *CtrContractShareDao) WhereNull(columns ...string) *CtrContractShareDao {
  294. return &CtrContractShareDao{M: d.M.WhereNull(columns...), Table: d.Table, TableAs: d.TableAs}
  295. }
  296. // WhereNotBetween builds "column NOT BETWEEN min AND max" statement.
  297. func (d *CtrContractShareDao) WhereNotBetween(column string, min, max interface{}) *CtrContractShareDao {
  298. return &CtrContractShareDao{M: d.M.WhereNotBetween(column, min, max), Table: d.Table, TableAs: d.TableAs}
  299. }
  300. // WhereNotLike builds "column NOT LIKE like" statement.
  301. func (d *CtrContractShareDao) WhereNotLike(column string, like interface{}) *CtrContractShareDao {
  302. return &CtrContractShareDao{M: d.M.WhereNotLike(column, like), Table: d.Table, TableAs: d.TableAs}
  303. }
  304. // WhereNot builds "column != value" statement.
  305. func (d *CtrContractShareDao) WhereNot(column string, value interface{}) *CtrContractShareDao {
  306. return &CtrContractShareDao{M: d.M.WhereNot(column, value), Table: d.Table, TableAs: d.TableAs}
  307. }
  308. // WhereNotIn builds "column NOT IN (in)" statement.
  309. func (d *CtrContractShareDao) WhereNotIn(column string, in interface{}) *CtrContractShareDao {
  310. return &CtrContractShareDao{M: d.M.WhereNotIn(column, in), Table: d.Table, TableAs: d.TableAs}
  311. }
  312. // WhereNotNull builds "columns[0] IS NOT NULL AND columns[1] IS NOT NULL ..." statement.
  313. func (d *CtrContractShareDao) WhereNotNull(columns ...string) *CtrContractShareDao {
  314. return &CtrContractShareDao{M: d.M.WhereNotNull(columns...), Table: d.Table, TableAs: d.TableAs}
  315. }
  316. // WhereOr adds "OR" condition to the where statement.
  317. func (d *CtrContractShareDao) WhereOr(where interface{}, args ...interface{}) *CtrContractShareDao {
  318. return &CtrContractShareDao{M: d.M.WhereOr(where, args...), Table: d.Table, TableAs: d.TableAs}
  319. }
  320. // WhereOrf builds "OR" condition string using fmt.Sprintf and arguments.
  321. func (d *CtrContractShareDao) WhereOrf(format string, args ...interface{}) *CtrContractShareDao {
  322. return &CtrContractShareDao{M: d.M.WhereOrf(format, args...), Table: d.Table, TableAs: d.TableAs}
  323. }
  324. // WhereOrLT builds "column < value" statement in "OR" conditions..
  325. func (d *CtrContractShareDao) WhereOrLT(column string, value interface{}) *CtrContractShareDao {
  326. return &CtrContractShareDao{M: d.M.WhereOrLT(column, value), Table: d.Table, TableAs: d.TableAs}
  327. }
  328. // WhereOrLTE builds "column <= value" statement in "OR" conditions..
  329. func (d *CtrContractShareDao) WhereOrLTE(column string, value interface{}) *CtrContractShareDao {
  330. return &CtrContractShareDao{M: d.M.WhereOrLTE(column, value), Table: d.Table, TableAs: d.TableAs}
  331. }
  332. // WhereOrGT builds "column > value" statement in "OR" conditions..
  333. func (d *CtrContractShareDao) WhereOrGT(column string, value interface{}) *CtrContractShareDao {
  334. return &CtrContractShareDao{M: d.M.WhereOrGT(column, value), Table: d.Table, TableAs: d.TableAs}
  335. }
  336. // WhereOrGTE builds "column >= value" statement in "OR" conditions..
  337. func (d *CtrContractShareDao) WhereOrGTE(column string, value interface{}) *CtrContractShareDao {
  338. return &CtrContractShareDao{M: d.M.WhereOrGTE(column, value), Table: d.Table, TableAs: d.TableAs}
  339. }
  340. // WhereOrBetween builds "column BETWEEN min AND max" statement in "OR" conditions.
  341. func (d *CtrContractShareDao) WhereOrBetween(column string, min, max interface{}) *CtrContractShareDao {
  342. return &CtrContractShareDao{M: d.M.WhereOrBetween(column, min, max), Table: d.Table, TableAs: d.TableAs}
  343. }
  344. // WhereOrLike builds "column LIKE like" statement in "OR" conditions.
  345. func (d *CtrContractShareDao) WhereOrLike(column string, like interface{}) *CtrContractShareDao {
  346. return &CtrContractShareDao{M: d.M.WhereOrLike(column, like), Table: d.Table, TableAs: d.TableAs}
  347. }
  348. // WhereOrIn builds "column IN (in)" statement in "OR" conditions.
  349. func (d *CtrContractShareDao) WhereOrIn(column string, in interface{}) *CtrContractShareDao {
  350. return &CtrContractShareDao{M: d.M.WhereOrIn(column, in), Table: d.Table, TableAs: d.TableAs}
  351. }
  352. // WhereOrNull builds "columns[0] IS NULL OR columns[1] IS NULL ..." statement in "OR" conditions.
  353. func (d *CtrContractShareDao) WhereOrNull(columns ...string) *CtrContractShareDao {
  354. return &CtrContractShareDao{M: d.M.WhereOrNull(columns...), Table: d.Table, TableAs: d.TableAs}
  355. }
  356. // WhereOrNotBetween builds "column NOT BETWEEN min AND max" statement in "OR" conditions.
  357. func (d *CtrContractShareDao) WhereOrNotBetween(column string, min, max interface{}) *CtrContractShareDao {
  358. return &CtrContractShareDao{M: d.M.WhereOrNotBetween(column, min, max), Table: d.Table, TableAs: d.TableAs}
  359. }
  360. // WhereOrNotLike builds "column NOT LIKE like" statement in "OR" conditions.
  361. func (d *CtrContractShareDao) WhereOrNotLike(column string, like interface{}) *CtrContractShareDao {
  362. return &CtrContractShareDao{M: d.M.WhereOrNotLike(column, like), Table: d.Table, TableAs: d.TableAs}
  363. }
  364. // WhereOrNotIn builds "column NOT IN (in)" statement.
  365. func (d *CtrContractShareDao) WhereOrNotIn(column string, in interface{}) *CtrContractShareDao {
  366. return &CtrContractShareDao{M: d.M.WhereOrNotIn(column, in), Table: d.Table, TableAs: d.TableAs}
  367. }
  368. // WhereOrNotNull builds "columns[0] IS NOT NULL OR columns[1] IS NOT NULL ..." statement in "OR" conditions.
  369. func (d *CtrContractShareDao) WhereOrNotNull(columns ...string) *CtrContractShareDao {
  370. return &CtrContractShareDao{M: d.M.WhereOrNotNull(columns...), Table: d.Table, TableAs: d.TableAs}
  371. }
  372. // Group sets the "GROUP BY" statement for the model.
  373. func (d *CtrContractShareDao) Group(groupBy ...string) *CtrContractShareDao {
  374. return &CtrContractShareDao{M: d.M.Group(groupBy...), Table: d.Table, TableAs: d.TableAs}
  375. }
  376. // And adds "AND" condition to the where statement.
  377. // Deprecated, use Where instead.
  378. func (d *CtrContractShareDao) And(where interface{}, args ...interface{}) *CtrContractShareDao {
  379. return &CtrContractShareDao{M: d.M.And(where, args...), Table: d.Table, TableAs: d.TableAs}
  380. }
  381. // Or adds "OR" condition to the where statement.
  382. // Deprecated, use WhereOr instead.
  383. func (d *CtrContractShareDao) Or(where interface{}, args ...interface{}) *CtrContractShareDao {
  384. return &CtrContractShareDao{M: d.M.Or(where, args...), Table: d.Table, TableAs: d.TableAs}
  385. }
  386. // GroupBy sets the "GROUP BY" statement for the model.
  387. func (d *CtrContractShareDao) GroupBy(groupBy string) *CtrContractShareDao {
  388. return &CtrContractShareDao{M: d.M.Group(groupBy), Table: d.Table, TableAs: d.TableAs}
  389. }
  390. // Order sets the "ORDER BY" statement for the model.
  391. func (d *CtrContractShareDao) Order(orderBy ...string) *CtrContractShareDao {
  392. return &CtrContractShareDao{M: d.M.Order(orderBy...), Table: d.Table, TableAs: d.TableAs}
  393. }
  394. // OrderAsc sets the "ORDER BY xxx ASC" statement for the model.
  395. func (d *CtrContractShareDao) OrderAsc(column string) *CtrContractShareDao {
  396. return &CtrContractShareDao{M: d.M.OrderAsc(column), Table: d.Table, TableAs: d.TableAs}
  397. }
  398. // OrderDesc sets the "ORDER BY xxx DESC" statement for the model.
  399. func (d *CtrContractShareDao) OrderDesc(column string) *CtrContractShareDao {
  400. return &CtrContractShareDao{M: d.M.OrderDesc(column), Table: d.Table, TableAs: d.TableAs}
  401. }
  402. // OrderRandom sets the "ORDER BY RANDOM()" statement for the model.
  403. func (d *CtrContractShareDao) OrderRandom() *CtrContractShareDao {
  404. return &CtrContractShareDao{M: d.M.OrderRandom(), Table: d.Table, TableAs: d.TableAs}
  405. }
  406. // OrderBy is alias of Model.Order.
  407. // See Model.Order.
  408. // Deprecated, use Order instead.
  409. func (d *CtrContractShareDao) OrderBy(orderBy string) *CtrContractShareDao {
  410. return &CtrContractShareDao{M: d.M.Order(orderBy), Table: d.Table, TableAs: d.TableAs}
  411. }
  412. // Limit sets the "LIMIT" statement for the model.
  413. // The parameter <limit> can be either one or two number, if passed two number is passed,
  414. // it then sets "LIMIT limit[0],limit[1]" statement for the model, or else it sets "LIMIT limit[0]"
  415. // statement.
  416. func (d *CtrContractShareDao) Limit(limit ...int) *CtrContractShareDao {
  417. return &CtrContractShareDao{M: d.M.Limit(limit...), Table: d.Table, TableAs: d.TableAs}
  418. }
  419. // Offset sets the "OFFSET" statement for the model.
  420. // It only makes sense for some databases like SQLServer, PostgreSQL, etc.
  421. func (d *CtrContractShareDao) Offset(offset int) *CtrContractShareDao {
  422. return &CtrContractShareDao{M: d.M.Offset(offset), Table: d.Table, TableAs: d.TableAs}
  423. }
  424. // Distinct forces the query to only return distinct results.
  425. func (d *CtrContractShareDao) Distinct() *CtrContractShareDao {
  426. return &CtrContractShareDao{M: d.M.Distinct(), Table: d.Table, TableAs: d.TableAs}
  427. }
  428. // Page sets the paging number for the model.
  429. // The parameter <page> is started from 1 for paging.
  430. // Note that, it differs that the Limit function start from 0 for "LIMIT" statement.
  431. func (d *CtrContractShareDao) Page(page, limit int) *CtrContractShareDao {
  432. return &CtrContractShareDao{M: d.M.Page(page, limit), Table: d.Table, TableAs: d.TableAs}
  433. }
  434. // Batch sets the batch operation number for the model.
  435. func (d *CtrContractShareDao) Batch(batch int) *CtrContractShareDao {
  436. return &CtrContractShareDao{M: d.M.Batch(batch), Table: d.Table, TableAs: d.TableAs}
  437. }
  438. // Cache sets the cache feature for the model. It caches the result of the sql, which means
  439. // if there's another same sql request, it just reads and returns the result from cache, it
  440. // but not committed and executed into the database.
  441. //
  442. // If the parameter <duration> < 0, which means it clear the cache with given <name>.
  443. // If the parameter <duration> = 0, which means it never expires.
  444. // If the parameter <duration> > 0, which means it expires after <duration>.
  445. //
  446. // The optional parameter <name> is used to bind a name to the cache, which means you can later
  447. // control the cache like changing the <duration> or clearing the cache with specified <name>.
  448. //
  449. // Note that, the cache feature is disabled if the model is operating on a transaction.
  450. func (d *CtrContractShareDao) Cache(duration time.Duration, name ...string) *CtrContractShareDao {
  451. return &CtrContractShareDao{M: d.M.Cache(duration, name...), Table: d.Table, TableAs: d.TableAs}
  452. }
  453. // Data sets the operation data for the model.
  454. // The parameter <data> can be type of string/map/gmap/slice/struct/*struct, etc.
  455. // Eg:
  456. // Data("uid=10000")
  457. // Data("uid", 10000)
  458. // Data(g.Map{"uid": 10000, "name":"john"})
  459. // Data(g.Slice{g.Map{"uid": 10000, "name":"john"}, g.Map{"uid": 20000, "name":"smith"})
  460. func (d *CtrContractShareDao) Data(data ...interface{}) *CtrContractShareDao {
  461. return &CtrContractShareDao{M: d.M.Data(data...), Table: d.Table, TableAs: d.TableAs}
  462. }
  463. // All does "SELECT FROM ..." statement for the model.
  464. // It retrieves the records from table and returns the result as []*model.CtrContractShare.
  465. // It returns nil if there's no record retrieved with the given conditions from table.
  466. //
  467. // The optional parameter <where> is the same as the parameter of M.Where function,
  468. // see M.Where.
  469. func (d *CtrContractShareDao) All(where ...interface{}) ([]*model.CtrContractShare, error) {
  470. all, err := d.M.All(where...)
  471. if err != nil {
  472. return nil, err
  473. }
  474. var entities []*model.CtrContractShare
  475. if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
  476. return nil, err
  477. }
  478. return entities, nil
  479. }
  480. // One retrieves one record from table and returns the result as *model.CtrContractShare.
  481. // It returns nil if there's no record retrieved with the given conditions from table.
  482. //
  483. // The optional parameter <where> is the same as the parameter of M.Where function,
  484. // see M.Where.
  485. func (d *CtrContractShareDao) One(where ...interface{}) (*model.CtrContractShare, error) {
  486. one, err := d.M.One(where...)
  487. if err != nil {
  488. return nil, err
  489. }
  490. var entity *model.CtrContractShare
  491. if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
  492. return nil, err
  493. }
  494. return entity, nil
  495. }
  496. // FindOne retrieves and returns a single Record by M.WherePri and M.One.
  497. // Also see M.WherePri and M.One.
  498. func (d *CtrContractShareDao) FindOne(where ...interface{}) (*model.CtrContractShare, error) {
  499. one, err := d.M.FindOne(where...)
  500. if err != nil {
  501. return nil, err
  502. }
  503. var entity *model.CtrContractShare
  504. if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
  505. return nil, err
  506. }
  507. return entity, nil
  508. }
  509. // FindAll retrieves and returns Result by by M.WherePri and M.All.
  510. // Also see M.WherePri and M.All.
  511. func (d *CtrContractShareDao) FindAll(where ...interface{}) ([]*model.CtrContractShare, error) {
  512. all, err := d.M.FindAll(where...)
  513. if err != nil {
  514. return nil, err
  515. }
  516. var entities []*model.CtrContractShare
  517. if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
  518. return nil, err
  519. }
  520. return entities, nil
  521. }
  522. // Struct retrieves one record from table and converts it into given struct.
  523. // The parameter <pointer> should be type of *struct/**struct. If type **struct is given,
  524. // it can create the struct internally during converting.
  525. //
  526. // The optional parameter <where> is the same as the parameter of Model.Where function,
  527. // see Model.Where.
  528. //
  529. // Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
  530. // from table and <pointer> is not nil.
  531. //
  532. // Eg:
  533. // user := new(User)
  534. // err := dao.User.Where("id", 1).Struct(user)
  535. //
  536. // user := (*User)(nil)
  537. // err := dao.User.Where("id", 1).Struct(&user)
  538. func (d *CtrContractShareDao) Struct(pointer interface{}, where ...interface{}) error {
  539. return d.M.Struct(pointer, where...)
  540. }
  541. // Structs retrieves records from table and converts them into given struct slice.
  542. // The parameter <pointer> should be type of *[]struct/*[]*struct. It can create and fill the struct
  543. // slice internally during converting.
  544. //
  545. // The optional parameter <where> is the same as the parameter of Model.Where function,
  546. // see Model.Where.
  547. //
  548. // Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
  549. // from table and <pointer> is not empty.
  550. //
  551. // Eg:
  552. // users := ([]User)(nil)
  553. // err := dao.User.Structs(&users)
  554. //
  555. // users := ([]*User)(nil)
  556. // err := dao.User.Structs(&users)
  557. func (d *CtrContractShareDao) Structs(pointer interface{}, where ...interface{}) error {
  558. return d.M.Structs(pointer, where...)
  559. }
  560. // Scan automatically calls Struct or Structs function according to the type of parameter <pointer>.
  561. // It calls function Struct if <pointer> is type of *struct/**struct.
  562. // It calls function Structs if <pointer> is type of *[]struct/*[]*struct.
  563. //
  564. // The optional parameter <where> is the same as the parameter of Model.Where function,
  565. // see Model.Where.
  566. //
  567. // Note that it returns sql.ErrNoRows if there's no record retrieved and given pointer is not empty or nil.
  568. //
  569. // Eg:
  570. // user := new(User)
  571. // err := dao.User.Where("id", 1).Scan(user)
  572. //
  573. // user := (*User)(nil)
  574. // err := dao.User.Where("id", 1).Scan(&user)
  575. //
  576. // users := ([]User)(nil)
  577. // err := dao.User.Scan(&users)
  578. //
  579. // users := ([]*User)(nil)
  580. // err := dao.User.Scan(&users)
  581. func (d *CtrContractShareDao) Scan(pointer interface{}, where ...interface{}) error {
  582. return d.M.Scan(pointer, where...)
  583. }
  584. // Chunk iterates the table with given size and callback function.
  585. func (d *CtrContractShareDao) Chunk(limit int, callback func(entities []*model.CtrContractShare, err error) bool) {
  586. d.M.Chunk(limit, func(result gdb.Result, err error) bool {
  587. var entities []*model.CtrContractShare
  588. err = result.Structs(&entities)
  589. if err == sql.ErrNoRows {
  590. return false
  591. }
  592. return callback(entities, err)
  593. })
  594. }
  595. // LockUpdate sets the lock for update for current operation.
  596. func (d *CtrContractShareDao) LockUpdate() *CtrContractShareDao {
  597. return &CtrContractShareDao{M: d.M.LockUpdate(), Table: d.Table, TableAs: d.TableAs}
  598. }
  599. // LockShared sets the lock in share mode for current operation.
  600. func (d *CtrContractShareDao) LockShared() *CtrContractShareDao {
  601. return &CtrContractShareDao{M: d.M.LockShared(), Table: d.Table, TableAs: d.TableAs}
  602. }
  603. // Unscoped enables/disables the soft deleting feature.
  604. func (d *CtrContractShareDao) Unscoped() *CtrContractShareDao {
  605. return &CtrContractShareDao{M: d.M.Unscoped(), Table: d.Table, TableAs: d.TableAs}
  606. }