sale_auction_temp.go 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. package models
  2. import (
  3. "database/sql"
  4. "time"
  5. "github.com/google/uuid"
  6. "github.com/guregu/null"
  7. "gorm.io/gorm"
  8. )
  9. var (
  10. _ = time.Second
  11. _ = sql.LevelDefault
  12. _ = null.Bool{}
  13. _ = uuid.UUID{}
  14. )
  15. /*
  16. DB Table Details
  17. -------------------------------------
  18. CREATE TABLE `sale_auction_temp` (
  19. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  20. `type` enum('creator','purchase','transfer','burn','bid') COLLATE utf8mb4_bin NOT NULL COMMENT '''creature\n''',
  21. `price` double DEFAULT NULL,
  22. `address` varchar(256) COLLATE utf8mb4_bin NOT NULL,
  23. `from_address` varchar(45) COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'transfer 타입일 경우에만 누구한테 보내는지에 대한 주소값 입력 필요(from_address)\n',
  24. `is_cancel` tinyint(4) DEFAULT '0',
  25. `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  26. `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  27. `deleted_at` timestamp NULL DEFAULT NULL,
  28. PRIMARY KEY (`id`),
  29. UNIQUE KEY `id_UNIQUE` (`id`)
  30. ) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
  31. JSON Sample
  32. -------------------------------------
  33. { "id": 60, "type": "ymMUORNUFlrXZhSNIvmQWyiVE", "price": 0.5252839248852443, "address": "RJMjiaGMeBCMGGQYjnlKwcGvG", "from_address": "LjeLLjffUOvDhdSquAeEKepZX", "is_cancel": 34, "created_at": "2302-12-12T19:09:09.030759881+09:00", "updated_at": "2305-06-28T21:28:02.955970383+09:00", "deleted_at": "2182-01-26T22:10:14.367291597+09:00"}
  34. Comments
  35. -------------------------------------
  36. [ 0] column is set for unsigned
  37. */
  38. // SaleAuctionTemp struct is a row record of the sale_auction_temp table in the metarare database
  39. type SaleAuctionTemp struct {
  40. //[ 0] id ubigint null: false primary: true isArray: false auto: true col: ubigint len: -1 default: []
  41. ID uint64 `gorm:"primary_key;AUTO_INCREMENT;column:id;type:ubigint;" json:"id"`
  42. //[ 1] type char(8) null: false primary: false isArray: false auto: false col: char len: 8 default: []
  43. Type string `gorm:"column:type;type:char;size:8;" json:"type"`
  44. //[ 2] price double null: true primary: false isArray: false auto: false col: double len: -1 default: []
  45. Price null.Float `gorm:"column:price;type:double;" json:"price"`
  46. //[ 3] address varchar(256) null: false primary: false isArray: false auto: false col: varchar len: 256 default: []
  47. Address string `gorm:"column:address;type:varchar;size:256;" json:"address"`
  48. //[ 4] from_address varchar(45) null: true primary: false isArray: false auto: false col: varchar len: 45 default: []
  49. FromAddress null.String `gorm:"column:from_address;type:varchar;size:45;" json:"from_address"` // transfer 타입일 경우에만 누구한테 보내는지에 대한 주소값 입력 필요(from_address)\n
  50. //[ 5] is_cancel tinyint null: true primary: false isArray: false auto: false col: tinyint len: -1 default: [0]
  51. IsCancel null.Int `gorm:"column:is_cancel;type:tinyint;default:0;" json:"is_cancel"`
  52. //[ 6] created_at timestamp null: false primary: false isArray: false auto: false col: timestamp len: -1 default: [CURRENT_TIMESTAMP]
  53. CreatedAt time.Time `gorm:"column:created_at;type:timestamp;default:CURRENT_TIMESTAMP;" json:"created_at"`
  54. //[ 7] updated_at timestamp null: false primary: false isArray: false auto: false col: timestamp len: -1 default: [CURRENT_TIMESTAMP]
  55. UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;default:CURRENT_TIMESTAMP;" json:"updated_at"`
  56. //[ 8] deleted_at timestamp null: true primary: false isArray: false auto: false col: timestamp len: -1 default: []
  57. DeletedAt null.Time `gorm:"column:deleted_at;type:timestamp;" json:"deleted_at"`
  58. }
  59. var sale_auction_tempTableInfo = &TableInfo{
  60. Name: "sale_auction_temp",
  61. Columns: []*ColumnInfo{
  62. &ColumnInfo{
  63. Index: 0,
  64. Name: "id",
  65. Comment: ``,
  66. Notes: `column is set for unsigned`,
  67. Nullable: false,
  68. DatabaseTypeName: "ubigint",
  69. DatabaseTypePretty: "ubigint",
  70. IsPrimaryKey: true,
  71. IsAutoIncrement: true,
  72. IsArray: false,
  73. ColumnType: "ubigint",
  74. ColumnLength: -1,
  75. GoFieldName: "ID",
  76. GoFieldType: "uint64",
  77. JSONFieldName: "id",
  78. ProtobufFieldName: "id",
  79. ProtobufType: "uint64",
  80. ProtobufPos: 1,
  81. },
  82. &ColumnInfo{
  83. Index: 1,
  84. Name: "type",
  85. Comment: ``,
  86. Notes: ``,
  87. Nullable: false,
  88. DatabaseTypeName: "char",
  89. DatabaseTypePretty: "char(8)",
  90. IsPrimaryKey: false,
  91. IsAutoIncrement: false,
  92. IsArray: false,
  93. ColumnType: "char",
  94. ColumnLength: 8,
  95. GoFieldName: "Type",
  96. GoFieldType: "string",
  97. JSONFieldName: "type",
  98. ProtobufFieldName: "type",
  99. ProtobufType: "string",
  100. ProtobufPos: 2,
  101. },
  102. &ColumnInfo{
  103. Index: 2,
  104. Name: "price",
  105. Comment: ``,
  106. Notes: ``,
  107. Nullable: true,
  108. DatabaseTypeName: "double",
  109. DatabaseTypePretty: "double",
  110. IsPrimaryKey: false,
  111. IsAutoIncrement: false,
  112. IsArray: false,
  113. ColumnType: "double",
  114. ColumnLength: -1,
  115. GoFieldName: "Price",
  116. GoFieldType: "null.Float",
  117. JSONFieldName: "price",
  118. ProtobufFieldName: "price",
  119. ProtobufType: "float",
  120. ProtobufPos: 3,
  121. },
  122. &ColumnInfo{
  123. Index: 3,
  124. Name: "address",
  125. Comment: ``,
  126. Notes: ``,
  127. Nullable: false,
  128. DatabaseTypeName: "varchar",
  129. DatabaseTypePretty: "varchar(256)",
  130. IsPrimaryKey: false,
  131. IsAutoIncrement: false,
  132. IsArray: false,
  133. ColumnType: "varchar",
  134. ColumnLength: 256,
  135. GoFieldName: "Address",
  136. GoFieldType: "string",
  137. JSONFieldName: "address",
  138. ProtobufFieldName: "address",
  139. ProtobufType: "string",
  140. ProtobufPos: 4,
  141. },
  142. &ColumnInfo{
  143. Index: 4,
  144. Name: "from_address",
  145. Comment: `transfer 타입일 경우에만 누구한테 보내는지에 대한 주소값 입력 필요(from_address)\n`,
  146. Notes: ``,
  147. Nullable: true,
  148. DatabaseTypeName: "varchar",
  149. DatabaseTypePretty: "varchar(45)",
  150. IsPrimaryKey: false,
  151. IsAutoIncrement: false,
  152. IsArray: false,
  153. ColumnType: "varchar",
  154. ColumnLength: 45,
  155. GoFieldName: "FromAddress",
  156. GoFieldType: "null.String",
  157. JSONFieldName: "from_address",
  158. ProtobufFieldName: "from_address",
  159. ProtobufType: "string",
  160. ProtobufPos: 5,
  161. },
  162. &ColumnInfo{
  163. Index: 5,
  164. Name: "is_cancel",
  165. Comment: ``,
  166. Notes: ``,
  167. Nullable: true,
  168. DatabaseTypeName: "tinyint",
  169. DatabaseTypePretty: "tinyint",
  170. IsPrimaryKey: false,
  171. IsAutoIncrement: false,
  172. IsArray: false,
  173. ColumnType: "tinyint",
  174. ColumnLength: -1,
  175. GoFieldName: "IsCancel",
  176. GoFieldType: "null.Int",
  177. JSONFieldName: "is_cancel",
  178. ProtobufFieldName: "is_cancel",
  179. ProtobufType: "int32",
  180. ProtobufPos: 6,
  181. },
  182. &ColumnInfo{
  183. Index: 6,
  184. Name: "created_at",
  185. Comment: ``,
  186. Notes: ``,
  187. Nullable: false,
  188. DatabaseTypeName: "timestamp",
  189. DatabaseTypePretty: "timestamp",
  190. IsPrimaryKey: false,
  191. IsAutoIncrement: false,
  192. IsArray: false,
  193. ColumnType: "timestamp",
  194. ColumnLength: -1,
  195. GoFieldName: "CreatedAt",
  196. GoFieldType: "time.Time",
  197. JSONFieldName: "created_at",
  198. ProtobufFieldName: "created_at",
  199. ProtobufType: "uint64",
  200. ProtobufPos: 7,
  201. },
  202. &ColumnInfo{
  203. Index: 7,
  204. Name: "updated_at",
  205. Comment: ``,
  206. Notes: ``,
  207. Nullable: false,
  208. DatabaseTypeName: "timestamp",
  209. DatabaseTypePretty: "timestamp",
  210. IsPrimaryKey: false,
  211. IsAutoIncrement: false,
  212. IsArray: false,
  213. ColumnType: "timestamp",
  214. ColumnLength: -1,
  215. GoFieldName: "UpdatedAt",
  216. GoFieldType: "time.Time",
  217. JSONFieldName: "updated_at",
  218. ProtobufFieldName: "updated_at",
  219. ProtobufType: "uint64",
  220. ProtobufPos: 8,
  221. },
  222. &ColumnInfo{
  223. Index: 8,
  224. Name: "deleted_at",
  225. Comment: ``,
  226. Notes: ``,
  227. Nullable: true,
  228. DatabaseTypeName: "timestamp",
  229. DatabaseTypePretty: "timestamp",
  230. IsPrimaryKey: false,
  231. IsAutoIncrement: false,
  232. IsArray: false,
  233. ColumnType: "timestamp",
  234. ColumnLength: -1,
  235. GoFieldName: "DeletedAt",
  236. GoFieldType: "null.Time",
  237. JSONFieldName: "deleted_at",
  238. ProtobufFieldName: "deleted_at",
  239. ProtobufType: "uint64",
  240. ProtobufPos: 9,
  241. },
  242. },
  243. }
  244. // TableName sets the insert table name for this struct type
  245. func (s *SaleAuctionTemp) TableName() string {
  246. return "sale_auction_temp"
  247. }
  248. // BeforeSave invoked before saving, return an error if field is not populated.
  249. func (s *SaleAuctionTemp) BeforeSave(*gorm.DB) error {
  250. return nil
  251. }
  252. // Prepare invoked before saving, can be used to populate fields etc.
  253. func (s *SaleAuctionTemp) Prepare() {
  254. }
  255. // Validate invoked before performing action, return an error if field is not populated.
  256. func (s *SaleAuctionTemp) Validate(action Action) error {
  257. return nil
  258. }
  259. // TableInfo return table meta data
  260. func (s *SaleAuctionTemp) TableInfo() *TableInfo {
  261. return sale_auction_tempTableInfo
  262. }