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 `setting` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `commission` double NOT NULL, `special_collection` varchar(128) COLLATE utf8mb4_bin NOT NULL, `gas_deposit` double NOT NULL, `treasury_address` varchar(256) COLLATE utf8mb4_bin NOT 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`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin JSON Sample ------------------------------------- { "id": 58, "commission": 0.26761219721913815, "special_collection": "fNuKUskZGeuTOrIvAMymkMgMT", "gas_deposit": 0.5107786712562139, "treasury_address": "KkxOkbxRwGcQFLZdTUIjIdxgx", "created_at": "2027-08-29T21:32:51.137710708+09:00", "updated_at": "2292-10-21T02:48:53.679850197+09:00", "deleted_at": "2210-06-07T02:52:12.736595621+09:00"} Comments ------------------------------------- [ 0] column is set for unsigned */ // Setting struct is a row record of the setting table in the metarare database type Setting 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] commission double null: false primary: false isArray: false auto: false col: double len: -1 default: [] Commission float64 `gorm:"column:commission;type:double;" json:"commission"` //[ 2] special_collection varchar(128) null: false primary: false isArray: false auto: false col: varchar len: 128 default: [] SpecialCollection string `gorm:"column:special_collection;type:varchar;size:128;" json:"special_collection"` //[ 3] gas_deposit double null: false primary: false isArray: false auto: false col: double len: -1 default: [] GasDeposit float64 `gorm:"column:gas_deposit;type:double;" json:"gas_deposit"` //[ 4] treasury_address varchar(256) null: false primary: false isArray: false auto: false col: varchar len: 256 default: [] TreasuryAddress string `gorm:"column:treasury_address;type:varchar;size:256;" json:"treasury_address"` //[ 5] 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"` //[ 6] 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"` //[ 7] 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 settingTableInfo = &TableInfo{ Name: "setting", 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: "commission", Comment: ``, Notes: ``, Nullable: false, DatabaseTypeName: "double", DatabaseTypePretty: "double", IsPrimaryKey: false, IsAutoIncrement: false, IsArray: false, ColumnType: "double", ColumnLength: -1, GoFieldName: "Commission", GoFieldType: "float64", JSONFieldName: "commission", ProtobufFieldName: "commission", ProtobufType: "float", ProtobufPos: 2, }, &ColumnInfo{ Index: 2, Name: "special_collection", Comment: ``, Notes: ``, Nullable: false, DatabaseTypeName: "varchar", DatabaseTypePretty: "varchar(128)", IsPrimaryKey: false, IsAutoIncrement: false, IsArray: false, ColumnType: "varchar", ColumnLength: 128, GoFieldName: "SpecialCollection", GoFieldType: "string", JSONFieldName: "special_collection", ProtobufFieldName: "special_collection", ProtobufType: "string", ProtobufPos: 3, }, &ColumnInfo{ Index: 3, Name: "gas_deposit", Comment: ``, Notes: ``, Nullable: false, DatabaseTypeName: "double", DatabaseTypePretty: "double", IsPrimaryKey: false, IsAutoIncrement: false, IsArray: false, ColumnType: "double", ColumnLength: -1, GoFieldName: "GasDeposit", GoFieldType: "float64", JSONFieldName: "gas_deposit", ProtobufFieldName: "gas_deposit", ProtobufType: "float", ProtobufPos: 4, }, &ColumnInfo{ Index: 4, Name: "treasury_address", Comment: ``, Notes: ``, Nullable: false, DatabaseTypeName: "varchar", DatabaseTypePretty: "varchar(256)", IsPrimaryKey: false, IsAutoIncrement: false, IsArray: false, ColumnType: "varchar", ColumnLength: 256, GoFieldName: "TreasuryAddress", GoFieldType: "string", JSONFieldName: "treasury_address", ProtobufFieldName: "treasury_address", ProtobufType: "string", ProtobufPos: 5, }, &ColumnInfo{ Index: 5, 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: 6, }, &ColumnInfo{ Index: 6, 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: 7, }, &ColumnInfo{ Index: 7, 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: 8, }, }, } // TableName sets the insert table name for this struct type func (s *Setting) TableName() string { return "setting" } // BeforeSave invoked before saving, return an error if field is not populated. func (s *Setting) BeforeSave(*gorm.DB) error { return nil } // Prepare invoked before saving, can be used to populate fields etc. func (s *Setting) Prepare() { } // Validate invoked before performing action, return an error if field is not populated. func (s *Setting) Validate(action Action) error { return nil } // TableInfo return table meta data func (s *Setting) TableInfo() *TableInfo { return settingTableInfo }