github.com/ztalab/ZACA@v0.0.1/database/mysql/cfssl-model/model/ocsp_responses.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 `ocsp_responses` ( 24 `serial_number` varchar(128) NOT NULL, 25 `authority_key_identifier` varchar(128) NOT NULL, 26 `body` text NOT NULL, 27 `expiry` timestamp NULL DEFAULT NULL, 28 PRIMARY KEY (`serial_number`,`authority_key_identifier`) 29 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 30 31 JSON Sample 32 ------------------------------------- 33 { "authority_key_identifier": "uccWRqKiBWSiUMLUVFMPDTagi", "body": "HgsoAwIJdyGtGlyHKIlydlsfZ", "expiry": "2038-07-05T20:42:34.735852468+08:00", "serial_number": "BVkGevecZyAogIjcXevDgWVHj"} 34 35 36 37 */ 38 39 // OcspResponses struct is a row record of the ocsp_responses table in the cap database 40 type OcspResponses struct { 41 //[ 0] serial_number varchar(128) null: false primary: true isArray: false auto: false col: varchar len: 128 default: [] 42 SerialNumber string `gorm:"primary_key;column:serial_number;type:varchar;size:128;" json:"serial_number" db:"serial_number"` 43 //[ 1] authority_key_identifier varchar(128) null: false primary: true isArray: false auto: false col: varchar len: 128 default: [] 44 AuthorityKeyIdentifier string `gorm:"primary_key;column:authority_key_identifier;type:varchar;size:128;" json:"authority_key_identifier" db:"authority_key_identifier"` 45 //[ 2] body text(65535) null: false primary: false isArray: false auto: false col: text len: 65535 default: [] 46 Body string `gorm:"column:body;type:text;size:65535;" json:"body" db:"body"` 47 //[ 3] expiry timestamp null: true primary: false isArray: false auto: false col: timestamp len: -1 default: [] 48 Expiry time.Time `gorm:"column:expiry;type:timestamp;" json:"expiry" db:"expiry"` 49 } 50 51 var ocsp_responsesTableInfo = &TableInfo{ 52 Name: "ocsp_responses", 53 Columns: []*ColumnInfo{ 54 55 &ColumnInfo{ 56 Index: 0, 57 Name: "serial_number", 58 Comment: ``, 59 Notes: ``, 60 Nullable: false, 61 DatabaseTypeName: "varchar", 62 DatabaseTypePretty: "varchar(128)", 63 IsPrimaryKey: true, 64 IsAutoIncrement: false, 65 IsArray: false, 66 ColumnType: "varchar", 67 ColumnLength: 128, 68 GoFieldName: "SerialNumber", 69 GoFieldType: "string", 70 JSONFieldName: "serial_number", 71 ProtobufFieldName: "serial_number", 72 ProtobufType: "string", 73 ProtobufPos: 1, 74 }, 75 76 &ColumnInfo{ 77 Index: 1, 78 Name: "authority_key_identifier", 79 Comment: ``, 80 Notes: ``, 81 Nullable: false, 82 DatabaseTypeName: "varchar", 83 DatabaseTypePretty: "varchar(128)", 84 IsPrimaryKey: true, 85 IsAutoIncrement: false, 86 IsArray: false, 87 ColumnType: "varchar", 88 ColumnLength: 128, 89 GoFieldName: "AuthorityKeyIdentifier", 90 GoFieldType: "string", 91 JSONFieldName: "authority_key_identifier", 92 ProtobufFieldName: "authority_key_identifier", 93 ProtobufType: "string", 94 ProtobufPos: 2, 95 }, 96 97 &ColumnInfo{ 98 Index: 2, 99 Name: "body", 100 Comment: ``, 101 Notes: ``, 102 Nullable: false, 103 DatabaseTypeName: "text", 104 DatabaseTypePretty: "text(65535)", 105 IsPrimaryKey: false, 106 IsAutoIncrement: false, 107 IsArray: false, 108 ColumnType: "text", 109 ColumnLength: 65535, 110 GoFieldName: "Body", 111 GoFieldType: "string", 112 JSONFieldName: "body", 113 ProtobufFieldName: "body", 114 ProtobufType: "string", 115 ProtobufPos: 3, 116 }, 117 118 &ColumnInfo{ 119 Index: 3, 120 Name: "expiry", 121 Comment: ``, 122 Notes: ``, 123 Nullable: true, 124 DatabaseTypeName: "timestamp", 125 DatabaseTypePretty: "timestamp", 126 IsPrimaryKey: false, 127 IsAutoIncrement: false, 128 IsArray: false, 129 ColumnType: "timestamp", 130 ColumnLength: -1, 131 GoFieldName: "Expiry", 132 GoFieldType: "time.Time", 133 JSONFieldName: "expiry", 134 ProtobufFieldName: "expiry", 135 ProtobufType: "uint64", 136 ProtobufPos: 4, 137 }, 138 }, 139 } 140 141 // TableName sets the insert table name for this struct type 142 func (o *OcspResponses) TableName() string { 143 return "ocsp_responses" 144 }