user_online_entity.go 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // ==========================================================================
  2. // This is auto-generated by gf cli tool. You may not really want to edit it.
  3. // ==========================================================================
  4. package user_online
  5. import (
  6. "database/sql"
  7. "github.com/gogf/gf/database/gdb"
  8. )
  9. // Entity is the golang structure for table user_online.
  10. type Entity struct {
  11. Id uint `orm:"id,primary" json:"id"` //
  12. Uuid string `orm:"uuid" json:"uuid"` // 用户标识
  13. Token string `orm:"token,unique" json:"token"` // 用户token
  14. CreateTime uint64 `orm:"create_time" json:"create_time"` // 登录时间
  15. UserName string `orm:"user_name" json:"user_name"` // 用户名
  16. Ip string `orm:"ip" json:"ip"` // 登录ip
  17. Explorer string `orm:"explorer" json:"explorer"` // 浏览器
  18. Os string `orm:"os" json:"os"` // 操作系统
  19. }
  20. // OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
  21. // the data and where attributes for empty values.
  22. func (r *Entity) OmitEmpty() *arModel {
  23. return Model.Data(r).OmitEmpty()
  24. }
  25. // Inserts does "INSERT...INTO..." statement for inserting current object into table.
  26. func (r *Entity) Insert() (result sql.Result, err error) {
  27. return Model.Data(r).Insert()
  28. }
  29. // Replace does "REPLACE...INTO..." statement for inserting current object into table.
  30. // If there's already another same record in the table (it checks using primary key or unique index),
  31. // it deletes it and insert this one.
  32. func (r *Entity) Replace() (result sql.Result, err error) {
  33. return Model.Data(r).Replace()
  34. }
  35. // Save does "INSERT...INTO..." statement for inserting/updating current object into table.
  36. // It updates the record if there's already another same record in the table
  37. // (it checks using primary key or unique index).
  38. func (r *Entity) Save() (result sql.Result, err error) {
  39. return Model.Data(r).Save()
  40. }
  41. // Update does "UPDATE...WHERE..." statement for updating current object from table.
  42. // It updates the record if there's already another same record in the table
  43. // (it checks using primary key or unique index).
  44. func (r *Entity) Update() (result sql.Result, err error) {
  45. return Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()
  46. }
  47. // Delete does "DELETE FROM...WHERE..." statement for deleting current object from table.
  48. func (r *Entity) Delete() (result sql.Result, err error) {
  49. return Model.Where(gdb.GetWhereConditionOfStruct(r)).Delete()
  50. }