github.com/vescale/zgraph@v0.0.0-20230410094002-959c02d50f95/types/types.go (about) 1 // Copyright 2023 zGraph Authors. All rights reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // See the License for the specific language governing permissions and 12 // limitations under the License. 13 14 package types 15 16 import "fmt" 17 18 type T uint8 19 20 const ( 21 Unknown T = 0 22 Bool T = 1 23 Int T = 2 24 Float T = 3 25 String T = 4 26 Bytes T = 5 27 Decimal T = 6 28 Date T = 7 29 Time T = 8 30 TimeTZ T = 9 31 Timestamp T = 10 32 TimestampTZ T = 11 33 Interval T = 12 34 Vertex T = 13 35 Edge T = 14 36 ) 37 38 func (t T) String() string { 39 switch t { 40 case Unknown: 41 return "Unknown" 42 case Bool: 43 return "Bool" 44 case Int: 45 return "Int" 46 case Float: 47 return "Float" 48 case String: 49 return "String" 50 case Bytes: 51 return "Bytes" 52 case Decimal: 53 return "Decimal" 54 case Date: 55 return "Date" 56 case Time: 57 return "Time" 58 case TimeTZ: 59 return "TimeTZ" 60 case Timestamp: 61 return "Timestamp" 62 case TimestampTZ: 63 return "TimestampTZ" 64 case Interval: 65 return "Interval" 66 case Vertex: 67 return "Vertex" 68 case Edge: 69 return "Edge" 70 default: 71 return fmt.Sprintf("unknown<%d>", t) 72 } 73 }