github.com/ztalab/ZACA@v0.0.1/database/mysql/cfssl-model/model/self_keypair.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 `self_keypair` ( 24 `id` int(11) unsigned NOT NULL AUTO_INCREMENT, 25 `name` varchar(40) NOT NULL, 26 `private_key` text, 27 `certificate` text, 28 `created_at` timestamp NULL DEFAULT NULL, 29 `updated_at` timestamp NULL DEFAULT NULL, 30 UNIQUE KEY `id` (`id`), 31 KEY `name` (`name`) USING BTREE 32 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 33 34 JSON Sample 35 ------------------------------------- 36 { "certificate": "WvVWjyOFZykWjUNNiChBewKis", "created_at": "2235-11-29T17:34:03.437242436+08:00", "updated_at": "2081-08-11T08:12:20.820976918+08:00", "id": 42, "name": "sdagyhnWyjVlIZVposUXUiwHI", "private_key": "BRAIisbANbBPGCpqNcgUbjnIV"} 37 38 39 Comments 40 ------------------------------------- 41 [ 0] column is set for unsignedWarning table: self_keypair does not have a primary key defined, setting col position 1 id as primary key 42 43 44 45 46 */ 47 48 // SelfKeypair struct is a row record of the self_keypair table in the cap database 49 type SelfKeypair struct { 50 //[ 0] id uint null: false primary: true isArray: false auto: true col: uint len: -1 default: [] 51 ID uint32 `gorm:"primary_key;AUTO_INCREMENT;column:id;type:uint;" json:"id" db:"id"` 52 //[ 1] name varchar(40) null: false primary: false isArray: false auto: false col: varchar len: 40 default: [] 53 Name string `gorm:"column:name;type:varchar;size:40;" json:"name" db:"name"` 54 //[ 2] private_key text(65535) null: true primary: false isArray: false auto: false col: text len: 65535 default: [] 55 PrivateKey sql.NullString `gorm:"column:private_key;type:text;size:65535;" json:"private_key" db:"private_key"` 56 //[ 3] certificate text(65535) null: true primary: false isArray: false auto: false col: text len: 65535 default: [] 57 Certificate sql.NullString `gorm:"column:certificate;type:text;size:65535;" json:"certificate" db:"certificate"` 58 //[ 4] created_at timestamp null: true primary: false isArray: false auto: false col: timestamp len: -1 default: [] 59 CreatedAt time.Time `gorm:"column:created_at;type:timestamp;" json:"created_at" db:"created_at"` 60 //[ 5] updated_at timestamp null: true primary: false isArray: false auto: false col: timestamp len: -1 default: [] 61 UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;" json:"updated_at" db:"updated_at"` 62 } 63 64 // TableName sets the insert table name for this struct type 65 func (s *SelfKeypair) TableName() string { 66 return "self_keypair" 67 }