package models import ( "database/sql" "time" "github.com/google/uuid" "github.com/guregu/null" "gorm.io/gorm" ) var ( _ = time.Second _ = sql.LevelDefault _ = null.Bool{} _ = uuid.UUID{} ) /* DB Table Details ------------------------------------- CREATE TABLE `bid_log` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `sale_id` bigint(20) unsigned NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `deleted_at` timestamp NULL DEFAULT NULL, `is_cancel` tinyint(4) NOT NULL DEFAULT '0', `price` double NOT NULL, `address` varchar(256) COLLATE utf8mb4_bin NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`), KEY `fk_bid_log_sale1_idx` (`sale_id`), CONSTRAINT `fk_bid_log_sale1` FOREIGN KEY (`sale_id`) REFERENCES `sale` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin JSON Sample ------------------------------------- { "id": 38, "sale_id": 64, "created_at": "2156-08-08T11:03:10.82280454+09:00", "updated_at": "2218-11-23T22:03:03.956572056+09:00", "deleted_at": "2060-10-14T01:16:12.869036271+09:00", "is_cancel": 52, "price": 0.7131124904145746, "address": "XXJsmsDCmliBjyRIkeDgrJKih"} Comments ------------------------------------- [ 0] column is set for unsigned [ 1] column is set for unsigned */ // BidLog struct is a row record of the bid_log table in the metarare database type BidLog struct { //[ 0] id ubigint null: false primary: true isArray: false auto: true col: ubigint len: -1 default: [] ID uint64 `gorm:"primary_key;AUTO_INCREMENT;column:id;type:ubigint;" json:"id"` //[ 1] sale_id ubigint null: false primary: false isArray: false auto: false col: ubigint len: -1 default: [] SaleID uint64 `gorm:"column:sale_id;type:ubigint;" json:"sale_id"` //[ 2] created_at timestamp null: false primary: false isArray: false auto: false col: timestamp len: -1 default: [CURRENT_TIMESTAMP] CreatedAt time.Time `gorm:"column:created_at;type:timestamp;default:CURRENT_TIMESTAMP;" json:"created_at"` //[ 3] updated_at timestamp null: false primary: false isArray: false auto: false col: timestamp len: -1 default: [CURRENT_TIMESTAMP] UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;default:CURRENT_TIMESTAMP;" json:"updated_at"` //[ 4] deleted_at timestamp null: true primary: false isArray: false auto: false col: timestamp len: -1 default: [] DeletedAt null.Time `gorm:"column:deleted_at;type:timestamp;" json:"deleted_at"` //[ 5] is_cancel tinyint null: false primary: false isArray: false auto: false col: tinyint len: -1 default: [0] IsCancel int32 `gorm:"column:is_cancel;type:tinyint;default:0;" json:"is_cancel"` //[ 6] price double null: false primary: false isArray: false auto: false col: double len: -1 default: [] Price float64 `gorm:"column:price;type:double;" json:"price"` //[ 7] address varchar(256) null: false primary: false isArray: false auto: false col: varchar len: 256 default: [] Address string `gorm:"column:address;type:varchar;size:256;" json:"address"` } var bid_logTableInfo = &TableInfo{ Name: "bid_log", Columns: []*ColumnInfo{ &ColumnInfo{ Index: 0, Name: "id", Comment: ``, Notes: `column is set for unsigned`, Nullable: false, DatabaseTypeName: "ubigint", DatabaseTypePretty: "ubigint", IsPrimaryKey: true, IsAutoIncrement: true, IsArray: false, ColumnType: "ubigint", ColumnLength: -1, GoFieldName: "ID", GoFieldType: "uint64", JSONFieldName: "id", ProtobufFieldName: "id", ProtobufType: "uint64", ProtobufPos: 1, }, &ColumnInfo{ Index: 1, Name: "sale_id", Comment: ``, Notes: `column is set for unsigned`, Nullable: false, DatabaseTypeName: "ubigint", DatabaseTypePretty: "ubigint", IsPrimaryKey: false, IsAutoIncrement: false, IsArray: false, ColumnType: "ubigint", ColumnLength: -1, GoFieldName: "SaleID", GoFieldType: "uint64", JSONFieldName: "sale_id", ProtobufFieldName: "sale_id", ProtobufType: "uint64", ProtobufPos: 2, }, &ColumnInfo{ Index: 2, Name: "created_at", Comment: ``, Notes: ``, Nullable: false, DatabaseTypeName: "timestamp", DatabaseTypePretty: "timestamp", IsPrimaryKey: false, IsAutoIncrement: false, IsArray: false, ColumnType: "timestamp", ColumnLength: -1, GoFieldName: "CreatedAt", GoFieldType: "time.Time", JSONFieldName: "created_at", ProtobufFieldName: "created_at", ProtobufType: "uint64", ProtobufPos: 3, }, &ColumnInfo{ Index: 3, Name: "updated_at", Comment: ``, Notes: ``, Nullable: false, DatabaseTypeName: "timestamp", DatabaseTypePretty: "timestamp", IsPrimaryKey: false, IsAutoIncrement: false, IsArray: false, ColumnType: "timestamp", ColumnLength: -1, GoFieldName: "UpdatedAt", GoFieldType: "time.Time", JSONFieldName: "updated_at", ProtobufFieldName: "updated_at", ProtobufType: "uint64", ProtobufPos: 4, }, &ColumnInfo{ Index: 4, Name: "deleted_at", Comment: ``, Notes: ``, Nullable: true, DatabaseTypeName: "timestamp", DatabaseTypePretty: "timestamp", IsPrimaryKey: false, IsAutoIncrement: false, IsArray: false, ColumnType: "timestamp", ColumnLength: -1, GoFieldName: "DeletedAt", GoFieldType: "null.Time", JSONFieldName: "deleted_at", ProtobufFieldName: "deleted_at", ProtobufType: "uint64", ProtobufPos: 5, }, &ColumnInfo{ Index: 5, Name: "is_cancel", Comment: ``, Notes: ``, Nullable: false, DatabaseTypeName: "tinyint", DatabaseTypePretty: "tinyint", IsPrimaryKey: false, IsAutoIncrement: false, IsArray: false, ColumnType: "tinyint", ColumnLength: -1, GoFieldName: "IsCancel", GoFieldType: "int32", JSONFieldName: "is_cancel", ProtobufFieldName: "is_cancel", ProtobufType: "int32", ProtobufPos: 6, }, &ColumnInfo{ Index: 6, Name: "price", Comment: ``, Notes: ``, Nullable: false, DatabaseTypeName: "double", DatabaseTypePretty: "double", IsPrimaryKey: false, IsAutoIncrement: false, IsArray: false, ColumnType: "double", ColumnLength: -1, GoFieldName: "Price", GoFieldType: "float64", JSONFieldName: "price", ProtobufFieldName: "price", ProtobufType: "float", ProtobufPos: 7, }, &ColumnInfo{ Index: 7, Name: "address", Comment: ``, Notes: ``, Nullable: false, DatabaseTypeName: "varchar", DatabaseTypePretty: "varchar(256)", IsPrimaryKey: false, IsAutoIncrement: false, IsArray: false, ColumnType: "varchar", ColumnLength: 256, GoFieldName: "Address", GoFieldType: "string", JSONFieldName: "address", ProtobufFieldName: "address", ProtobufType: "string", ProtobufPos: 8, }, }, } // TableName sets the insert table name for this struct type func (b *BidLog) TableName() string { return "bid_log" } // BeforeSave invoked before saving, return an error if field is not populated. func (b *BidLog) BeforeSave(*gorm.DB) error { return nil } // Prepare invoked before saving, can be used to populate fields etc. func (b *BidLog) Prepare() { } // Validate invoked before performing action, return an error if field is not populated. func (b *BidLog) Validate(action Action) error { return nil } // TableInfo return table meta data func (b *BidLog) TableInfo() *TableInfo { return bid_logTableInfo }