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 `currency_price` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `eth` double NOT NULL, `mf` double NOT NULL, `mr` double 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`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin JSON Sample ------------------------------------- { "id": 69, "eth": 0.1595842824549021, "mf": 0.017632045175807368, "mr": 0.9302054954344651, "created_at": "2294-07-30T19:13:49.896724656+09:00", "updated_at": "2296-03-25T10:20:56.792055059+09:00", "deleted_at": "2180-10-28T17:52:32.433015569+09:00"} Comments ------------------------------------- [ 0] column is set for unsigned */ // CurrencyPrice struct is a row record of the currency_price table in the metarare database type CurrencyPrice 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] eth double null: false primary: false isArray: false auto: false col: double len: -1 default: [] Eth float64 `gorm:"column:eth;type:double;" json:"eth"` //[ 2] mf double null: false primary: false isArray: false auto: false col: double len: -1 default: [] Mf float64 `gorm:"column:mf;type:double;" json:"mf"` //[ 3] mr double null: false primary: false isArray: false auto: false col: double len: -1 default: [] Mr float64 `gorm:"column:mr;type:double;" json:"mr"` //[ 4] 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"` //[ 5] 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"` //[ 6] 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 currency_priceTableInfo = &TableInfo{ Name: "currency_price", 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: "eth", Comment: ``, Notes: ``, Nullable: false, DatabaseTypeName: "double", DatabaseTypePretty: "double", IsPrimaryKey: false, IsAutoIncrement: false, IsArray: false, ColumnType: "double", ColumnLength: -1, GoFieldName: "Eth", GoFieldType: "float64", JSONFieldName: "eth", ProtobufFieldName: "eth", ProtobufType: "float", ProtobufPos: 2, }, &ColumnInfo{ Index: 2, Name: "mf", Comment: ``, Notes: ``, Nullable: false, DatabaseTypeName: "double", DatabaseTypePretty: "double", IsPrimaryKey: false, IsAutoIncrement: false, IsArray: false, ColumnType: "double", ColumnLength: -1, GoFieldName: "Mf", GoFieldType: "float64", JSONFieldName: "mf", ProtobufFieldName: "mf", ProtobufType: "float", ProtobufPos: 3, }, &ColumnInfo{ Index: 3, Name: "mr", Comment: ``, Notes: ``, Nullable: false, DatabaseTypeName: "double", DatabaseTypePretty: "double", IsPrimaryKey: false, IsAutoIncrement: false, IsArray: false, ColumnType: "double", ColumnLength: -1, GoFieldName: "Mr", GoFieldType: "float64", JSONFieldName: "mr", ProtobufFieldName: "mr", ProtobufType: "float", ProtobufPos: 4, }, &ColumnInfo{ Index: 4, 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: 5, }, &ColumnInfo{ Index: 5, 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: 6, }, &ColumnInfo{ Index: 6, 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: 7, }, }, } // TableName sets the insert table name for this struct type func (c *CurrencyPrice) TableName() string { return "currency_price" } // BeforeSave invoked before saving, return an error if field is not populated. func (c *CurrencyPrice) BeforeSave(*gorm.DB) error { return nil } // Prepare invoked before saving, can be used to populate fields etc. func (c *CurrencyPrice) Prepare() { } // Validate invoked before performing action, return an error if field is not populated. func (c *CurrencyPrice) Validate(action Action) error { return nil } // TableInfo return table meta data func (c *CurrencyPrice) TableInfo() *TableInfo { return currency_priceTableInfo }