github.com/hyperledger/burrow@v0.34.5-0.20220512172541-77f09336001d/vent/types/sql_column_type.go (about) 1 package types 2 3 // SQLColumnType to store generic SQL column types 4 type SQLColumnType int 5 6 // generic SQL column types 7 const ( 8 SQLColumnTypeBool SQLColumnType = iota 9 SQLColumnTypeByteA 10 SQLColumnTypeInt 11 SQLColumnTypeSerial 12 SQLColumnTypeText 13 SQLColumnTypeVarchar 14 SQLColumnTypeTimeStamp 15 SQLColumnTypeNumeric 16 SQLColumnTypeJSON 17 SQLColumnTypeBigInt 18 ) 19 20 func (ct SQLColumnType) String() string { 21 switch ct { 22 case SQLColumnTypeBool: 23 return "bool" 24 case SQLColumnTypeByteA: 25 return "bytea" 26 case SQLColumnTypeInt: 27 return "int" 28 case SQLColumnTypeSerial: 29 return "serial" 30 case SQLColumnTypeText: 31 return "text" 32 case SQLColumnTypeVarchar: 33 return "varchar" 34 case SQLColumnTypeTimeStamp: 35 return "timestamp" 36 case SQLColumnTypeNumeric: 37 return "numeric" 38 case SQLColumnTypeJSON: 39 return "json" 40 case SQLColumnTypeBigInt: 41 return "bigint" 42 } 43 return "unknown SQL type" 44 } 45 46 // IsNumeric determines if an sqlColumnType is numeric 47 func (ct SQLColumnType) IsNumeric() bool { 48 return ct == SQLColumnTypeInt || ct == SQLColumnTypeSerial || ct == SQLColumnTypeNumeric || ct == SQLColumnTypeBigInt 49 }