github.com/ztalab/ZACA@v0.0.1/database/mysql/cfssl-model/model/forbid.go (about) 1 package model 2 3 import ( 4 "database/sql" 5 "time" 6 7 "github.com/guregu/null" 8 uuid "github.com/satori/go.uuid" 9 ) 10 11 var ( 12 _ = time.Second 13 _ = sql.LevelDefault 14 _ = null.Bool{} 15 _ = uuid.UUID{} 16 ) 17 18 /* 19 DB Table Details 20 ------------------------------------- 21 22 23 CREATE TABLE `forbid` ( 24 `id` int(11) unsigned NOT NULL AUTO_INCREMENT, 25 `unique_id` varchar(40) NOT NULL, 26 `created_at` timestamp NULL DEFAULT NULL, 27 `updated_at` timestamp NULL DEFAULT NULL, 28 `deleted_at` timestamp NULL DEFAULT NULL, 29 PRIMARY KEY (`id`) 30 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 31 32 JSON Sample 33 ------------------------------------- 34 { "id": 57, "unique_id": "xNqChbAQxwlXQscFcNacXlEFR", "created_at": "2189-03-28T13:29:03.755973202+08:00", "updated_at": "2165-07-06T04:08:04.165658654+08:00", "deleted_at": "2062-09-27T18:12:40.213950692+08:00"} 35 36 37 Comments 38 ------------------------------------- 39 [ 0] column is set for unsigned 40 41 42 43 */ 44 45 // Forbid struct is a row record of the forbid table in the cap database 46 type Forbid struct { 47 //[ 0] id uint null: false primary: true isArray: false auto: true col: uint len: -1 default: [] 48 ID uint32 `gorm:"primary_key;AUTO_INCREMENT;column:id;type:uint;" json:"id" db:"id"` 49 //[ 1] unique_id varchar(40) null: false primary: false isArray: false auto: false col: varchar len: 40 default: [] 50 UniqueID string `gorm:"column:unique_id;type:varchar;size:40;" json:"unique_id" db:"unique_id"` 51 //[ 2] created_at timestamp null: true primary: false isArray: false auto: false col: timestamp len: -1 default: [] 52 CreatedAt time.Time `gorm:"column:created_at;type:timestamp;" json:"created_at" db:"created_at"` 53 //[ 3] updated_at timestamp null: true primary: false isArray: false auto: false col: timestamp len: -1 default: [] 54 UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;" json:"updated_at" db:"updated_at"` 55 //[ 4] deleted_at timestamp null: true primary: false isArray: false auto: false col: timestamp len: -1 default: [] 56 DeletedAt null.Time `gorm:"column:deleted_at;type:timestamp;" json:"deleted_at" db:"deleted_at"` 57 } 58 59 var forbidTableInfo = &TableInfo{ 60 Name: "forbid", 61 Columns: []*ColumnInfo{ 62 63 &ColumnInfo{ 64 Index: 0, 65 Name: "id", 66 Comment: ``, 67 Notes: `column is set for unsigned`, 68 Nullable: false, 69 DatabaseTypeName: "uint", 70 DatabaseTypePretty: "uint", 71 IsPrimaryKey: true, 72 IsAutoIncrement: true, 73 IsArray: false, 74 ColumnType: "uint", 75 ColumnLength: -1, 76 GoFieldName: "ID", 77 GoFieldType: "uint32", 78 JSONFieldName: "id", 79 ProtobufFieldName: "id", 80 ProtobufType: "uint32", 81 ProtobufPos: 1, 82 }, 83 84 &ColumnInfo{ 85 Index: 1, 86 Name: "unique_id", 87 Comment: ``, 88 Notes: ``, 89 Nullable: false, 90 DatabaseTypeName: "varchar", 91 DatabaseTypePretty: "varchar(40)", 92 IsPrimaryKey: false, 93 IsAutoIncrement: false, 94 IsArray: false, 95 ColumnType: "varchar", 96 ColumnLength: 40, 97 GoFieldName: "UniqueID", 98 GoFieldType: "string", 99 JSONFieldName: "unique_id", 100 ProtobufFieldName: "unique_id", 101 ProtobufType: "string", 102 ProtobufPos: 2, 103 }, 104 105 &ColumnInfo{ 106 Index: 2, 107 Name: "created_at", 108 Comment: ``, 109 Notes: ``, 110 Nullable: true, 111 DatabaseTypeName: "timestamp", 112 DatabaseTypePretty: "timestamp", 113 IsPrimaryKey: false, 114 IsAutoIncrement: false, 115 IsArray: false, 116 ColumnType: "timestamp", 117 ColumnLength: -1, 118 GoFieldName: "CreatedAt", 119 GoFieldType: "time.Time", 120 JSONFieldName: "created_at", 121 ProtobufFieldName: "created_at", 122 ProtobufType: "uint64", 123 ProtobufPos: 3, 124 }, 125 126 &ColumnInfo{ 127 Index: 3, 128 Name: "updated_at", 129 Comment: ``, 130 Notes: ``, 131 Nullable: true, 132 DatabaseTypeName: "timestamp", 133 DatabaseTypePretty: "timestamp", 134 IsPrimaryKey: false, 135 IsAutoIncrement: false, 136 IsArray: false, 137 ColumnType: "timestamp", 138 ColumnLength: -1, 139 GoFieldName: "UpdatedAt", 140 GoFieldType: "time.Time", 141 JSONFieldName: "updated_at", 142 ProtobufFieldName: "updated_at", 143 ProtobufType: "uint64", 144 ProtobufPos: 4, 145 }, 146 147 &ColumnInfo{ 148 Index: 4, 149 Name: "deleted_at", 150 Comment: ``, 151 Notes: ``, 152 Nullable: true, 153 DatabaseTypeName: "timestamp", 154 DatabaseTypePretty: "timestamp", 155 IsPrimaryKey: false, 156 IsAutoIncrement: false, 157 IsArray: false, 158 ColumnType: "timestamp", 159 ColumnLength: -1, 160 GoFieldName: "DeletedAt", 161 GoFieldType: "time.Time", 162 JSONFieldName: "deleted_at", 163 ProtobufFieldName: "deleted_at", 164 ProtobufType: "uint64", 165 ProtobufPos: 5, 166 }, 167 }, 168 } 169 170 // TableName sets the insert table name for this struct type 171 func (f *Forbid) TableName() string { 172 return "forbid" 173 }