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 `user_wallet` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `user_id` bigint(20) unsigned NOT NULL, `address` varchar(256) COLLATE utf8mb4_bin NOT NULL, `private_key` varchar(256) COLLATE utf8mb4_bin NOT NULL, `check_sum` varchar(256) COLLATE utf8mb4_bin NOT NULL, `enc_version` int(11) NOT NULL DEFAULT '1', `certification_code` varchar(256) COLLATE utf8mb4_bin DEFAULT NULL, `request_currency` enum('default','eth','mf','mr') COLLATE utf8mb4_bin NOT NULL DEFAULT 'default', `request_balance` double DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `deleted_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`), UNIQUE KEY `private_key_UNIQUE` (`private_key`), KEY `fk_user_wallet_user1_idx` (`user_id`), CONSTRAINT `fk_user_wallet_user1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin JSON Sample ------------------------------------- { "id": 3, "user_id": 55, "address": "vlxMwpHwhGhRcjvMpqsLZKrHC", "private_key": "INPnlZdPThimnScmGRRLCAgcY", "check_sum": "yvRhoXwAoHuiiqNIbxfGJWdll", "enc_version": 92, "certification_code": "MlBNjXqESDlisqhSbjMiyWohX", "request_currency": "oINxnvEbHWyvHdKVkcmugTuef", "request_balance": 0.5502714698436856, "created_at": "2042-02-02T02:03:25.520358736+09:00", "updated_at": "2247-08-09T00:39:55.890194209+09:00", "deleted_at": "2312-06-02T18:55:31.336393419+09:00"} Comments ------------------------------------- [ 0] column is set for unsigned [ 1] column is set for unsigned */ // UserWallet struct is a row record of the user_wallet table in the metarare database type UserWallet 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] user_id ubigint null: false primary: false isArray: false auto: false col: ubigint len: -1 default: [] UserID uint64 `gorm:"column:user_id;type:ubigint;" json:"user_id"` //[ 2] 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"` //[ 3] private_key varchar(256) null: false primary: false isArray: false auto: false col: varchar len: 256 default: [] PrivateKey string `gorm:"column:private_key;type:varchar;size:256;" json:"private_key"` //[ 4] check_sum varchar(256) null: false primary: false isArray: false auto: false col: varchar len: 256 default: [] CheckSum string `gorm:"column:check_sum;type:varchar;size:256;" json:"check_sum"` //[ 5] enc_version int null: false primary: false isArray: false auto: false col: int len: -1 default: [1] EncVersion int32 `gorm:"column:enc_version;type:int;default:1;" json:"enc_version"` //[ 6] certification_code varchar(256) null: true primary: false isArray: false auto: false col: varchar len: 256 default: [] CertificationCode null.String `gorm:"column:certification_code;type:varchar;size:256;" json:"certification_code"` //[ 7] request_currency char(7) null: false primary: false isArray: false auto: false col: char len: 7 default: [default] RequestCurrency string `gorm:"column:request_currency;type:char;size:7;default:default;" json:"request_currency"` //[ 8] request_balance double null: true primary: false isArray: false auto: false col: double len: -1 default: [] RequestBalance null.Float `gorm:"column:request_balance;type:double;" json:"request_balance"` //[ 9] 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"` //[10] 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"` //[11] 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"` } var user_walletTableInfo = &TableInfo{ Name: "user_wallet", 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: "user_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: "UserID", GoFieldType: "uint64", JSONFieldName: "user_id", ProtobufFieldName: "user_id", ProtobufType: "uint64", ProtobufPos: 2, }, &ColumnInfo{ Index: 2, 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: 3, }, &ColumnInfo{ Index: 3, Name: "private_key", Comment: ``, Notes: ``, Nullable: false, DatabaseTypeName: "varchar", DatabaseTypePretty: "varchar(256)", IsPrimaryKey: false, IsAutoIncrement: false, IsArray: false, ColumnType: "varchar", ColumnLength: 256, GoFieldName: "PrivateKey", GoFieldType: "string", JSONFieldName: "private_key", ProtobufFieldName: "private_key", ProtobufType: "string", ProtobufPos: 4, }, &ColumnInfo{ Index: 4, Name: "check_sum", Comment: ``, Notes: ``, Nullable: false, DatabaseTypeName: "varchar", DatabaseTypePretty: "varchar(256)", IsPrimaryKey: false, IsAutoIncrement: false, IsArray: false, ColumnType: "varchar", ColumnLength: 256, GoFieldName: "CheckSum", GoFieldType: "string", JSONFieldName: "check_sum", ProtobufFieldName: "check_sum", ProtobufType: "string", ProtobufPos: 5, }, &ColumnInfo{ Index: 5, Name: "enc_version", Comment: ``, Notes: ``, Nullable: false, DatabaseTypeName: "int", DatabaseTypePretty: "int", IsPrimaryKey: false, IsAutoIncrement: false, IsArray: false, ColumnType: "int", ColumnLength: -1, GoFieldName: "EncVersion", GoFieldType: "int32", JSONFieldName: "enc_version", ProtobufFieldName: "enc_version", ProtobufType: "int32", ProtobufPos: 6, }, &ColumnInfo{ Index: 6, Name: "certification_code", Comment: ``, Notes: ``, Nullable: true, DatabaseTypeName: "varchar", DatabaseTypePretty: "varchar(256)", IsPrimaryKey: false, IsAutoIncrement: false, IsArray: false, ColumnType: "varchar", ColumnLength: 256, GoFieldName: "CertificationCode", GoFieldType: "null.String", JSONFieldName: "certification_code", ProtobufFieldName: "certification_code", ProtobufType: "string", ProtobufPos: 7, }, &ColumnInfo{ Index: 7, Name: "request_currency", Comment: ``, Notes: ``, Nullable: false, DatabaseTypeName: "char", DatabaseTypePretty: "char(7)", IsPrimaryKey: false, IsAutoIncrement: false, IsArray: false, ColumnType: "char", ColumnLength: 7, GoFieldName: "RequestCurrency", GoFieldType: "string", JSONFieldName: "request_currency", ProtobufFieldName: "request_currency", ProtobufType: "string", ProtobufPos: 8, }, &ColumnInfo{ Index: 8, Name: "request_balance", Comment: ``, Notes: ``, Nullable: true, DatabaseTypeName: "double", DatabaseTypePretty: "double", IsPrimaryKey: false, IsAutoIncrement: false, IsArray: false, ColumnType: "double", ColumnLength: -1, GoFieldName: "RequestBalance", GoFieldType: "null.Float", JSONFieldName: "request_balance", ProtobufFieldName: "request_balance", ProtobufType: "float", ProtobufPos: 9, }, &ColumnInfo{ Index: 9, 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: 10, }, &ColumnInfo{ Index: 10, 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: 11, }, &ColumnInfo{ Index: 11, 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: 12, }, }, } // TableName sets the insert table name for this struct type func (u *UserWallet) TableName() string { return "user_wallet" } // BeforeSave invoked before saving, return an error if field is not populated. func (u *UserWallet) BeforeSave(*gorm.DB) error { return nil } // Prepare invoked before saving, can be used to populate fields etc. func (u *UserWallet) Prepare() { } // Validate invoked before performing action, return an error if field is not populated. func (u *UserWallet) Validate(action Action) error { return nil } // TableInfo return table meta data func (u *UserWallet) TableInfo() *TableInfo { return user_walletTableInfo }