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 `collection_profile` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `collection_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, `name` varchar(256) COLLATE utf8mb4_bin NOT NULL, `description` text COLLATE utf8mb4_bin NOT NULL, `thumbnail_image` varchar(256) COLLATE utf8mb4_bin NOT NULL, `cover_image` varchar(256) COLLATE utf8mb4_bin DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`), UNIQUE KEY `name_UNIQUE` (`name`), KEY `fk_collection_profile_collection1_idx` (`collection_id`), CONSTRAINT `fk_collection_profile_collection1` FOREIGN KEY (`collection_id`) REFERENCES `collection` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin JSON Sample ------------------------------------- { "id": 83, "collection_id": 18, "created_at": "2251-01-15T23:16:21.56410801+09:00", "updated_at": "2172-08-04T01:20:48.009137936+09:00", "deleted_at": "2217-12-09T10:16:54.547773738+09:00", "name": "ZpmyymPusrukoivrDxhxNHQjg", "description": "BAiKqZitlUjTxBUuNImDjBTcA", "thumbnail_image": "iosxEGOcVfOcAXBfIQhyLvKIP", "cover_image": "fRUEbCjORmMbcsHrFRBRhuDJp"} Comments ------------------------------------- [ 0] column is set for unsigned [ 1] column is set for unsigned */ // CollectionProfile struct is a row record of the collection_profile table in the metarare database type CollectionProfile 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] collection_id ubigint null: false primary: false isArray: false auto: false col: ubigint len: -1 default: [] CollectionID uint64 `gorm:"column:collection_id;type:ubigint;" json:"collection_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] name varchar(256) null: false primary: false isArray: false auto: false col: varchar len: 256 default: [] Name string `gorm:"column:name;type:varchar;size:256;" json:"name"` //[ 6] description text(65535) null: false primary: false isArray: false auto: false col: text len: 65535 default: [] Description string `gorm:"column:description;type:text;size:65535;" json:"description"` //[ 7] thumbnail_image varchar(256) null: false primary: false isArray: false auto: false col: varchar len: 256 default: [] ThumbnailImage string `gorm:"column:thumbnail_image;type:varchar;size:256;" json:"thumbnail_image"` //[ 8] cover_image varchar(256) null: true primary: false isArray: false auto: false col: varchar len: 256 default: [] CoverImage null.String `gorm:"column:cover_image;type:varchar;size:256;" json:"cover_image"` } var collection_profileTableInfo = &TableInfo{ Name: "collection_profile", 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: "collection_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: "CollectionID", GoFieldType: "uint64", JSONFieldName: "collection_id", ProtobufFieldName: "collection_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: "name", Comment: ``, Notes: ``, Nullable: false, DatabaseTypeName: "varchar", DatabaseTypePretty: "varchar(256)", IsPrimaryKey: false, IsAutoIncrement: false, IsArray: false, ColumnType: "varchar", ColumnLength: 256, GoFieldName: "Name", GoFieldType: "string", JSONFieldName: "name", ProtobufFieldName: "name", ProtobufType: "string", ProtobufPos: 6, }, &ColumnInfo{ Index: 6, Name: "description", Comment: ``, Notes: ``, Nullable: false, DatabaseTypeName: "text", DatabaseTypePretty: "text(65535)", IsPrimaryKey: false, IsAutoIncrement: false, IsArray: false, ColumnType: "text", ColumnLength: 65535, GoFieldName: "Description", GoFieldType: "string", JSONFieldName: "description", ProtobufFieldName: "description", ProtobufType: "string", ProtobufPos: 7, }, &ColumnInfo{ Index: 7, Name: "thumbnail_image", Comment: ``, Notes: ``, Nullable: false, DatabaseTypeName: "varchar", DatabaseTypePretty: "varchar(256)", IsPrimaryKey: false, IsAutoIncrement: false, IsArray: false, ColumnType: "varchar", ColumnLength: 256, GoFieldName: "ThumbnailImage", GoFieldType: "string", JSONFieldName: "thumbnail_image", ProtobufFieldName: "thumbnail_image", ProtobufType: "string", ProtobufPos: 8, }, &ColumnInfo{ Index: 8, Name: "cover_image", Comment: ``, Notes: ``, Nullable: true, DatabaseTypeName: "varchar", DatabaseTypePretty: "varchar(256)", IsPrimaryKey: false, IsAutoIncrement: false, IsArray: false, ColumnType: "varchar", ColumnLength: 256, GoFieldName: "CoverImage", GoFieldType: "null.String", JSONFieldName: "cover_image", ProtobufFieldName: "cover_image", ProtobufType: "string", ProtobufPos: 9, }, }, } // TableName sets the insert table name for this struct type func (c *CollectionProfile) TableName() string { return "collection_profile" } // BeforeSave invoked before saving, return an error if field is not populated. func (c *CollectionProfile) BeforeSave(*gorm.DB) error { return nil } // Prepare invoked before saving, can be used to populate fields etc. func (c *CollectionProfile) Prepare() { } // Validate invoked before performing action, return an error if field is not populated. func (c *CollectionProfile) Validate(action Action) error { return nil } // TableInfo return table meta data func (c *CollectionProfile) TableInfo() *TableInfo { return collection_profileTableInfo }