github.com/RevenueMonster/sqlike@v1.0.6/sql/type/type.go (about)

     1  package sqltype
     2  
     3  // Type : merge the golang data type and custom type
     4  type Type int
     5  
     6  // types :
     7  const (
     8  	String Type = iota
     9  	Char
    10  	Bool
    11  	Byte
    12  	Int
    13  	Int8
    14  	Int16
    15  	Int32
    16  	Int64
    17  	Uint
    18  	Uint8
    19  	Uint16
    20  	Uint32
    21  	Uint64
    22  	Float32
    23  	Float64
    24  	GeoPoint
    25  	Date
    26  	DateTime
    27  	Time
    28  	Timestamp
    29  	Struct
    30  	Array
    31  	Slice
    32  	Map
    33  	JSON
    34  	Enum
    35  	Set
    36  	UUID
    37  	Point
    38  	LineString
    39  	Polygon
    40  	MultiPoint
    41  	MultiLineString
    42  	MultiPolygon
    43  )
    44  
    45  var names = map[Type]string{
    46  	String:          "string",
    47  	Bool:            "boolean",
    48  	Byte:            "byte",
    49  	Int:             "int",
    50  	Int8:            "int8",
    51  	Int16:           "int16",
    52  	Int32:           "int32",
    53  	Int64:           "int64",
    54  	Uint:            "uint",
    55  	Uint8:           "uint8",
    56  	Uint16:          "uint16",
    57  	Uint32:          "uint32",
    58  	Uint64:          "uint64",
    59  	Float32:         "float32",
    60  	Float64:         "float64",
    61  	Slice:           "slice",
    62  	Map:             "map",
    63  	Struct:          "struct",
    64  	Timestamp:       "timestamp",
    65  	DateTime:        "datetime",
    66  	Time:            "time",
    67  	JSON:            "json",
    68  	UUID:            "uuid",
    69  	Point:           "point",
    70  	LineString:      "linestring",
    71  	Polygon:         "polygon",
    72  	MultiPoint:      "multipoint",
    73  	MultiLineString: "multilinestring",
    74  	MultiPolygon:    "multipolygon",
    75  }
    76  
    77  // String :
    78  func (t Type) String() string {
    79  	if v, ok := names[t]; ok {
    80  		return v
    81  	}
    82  	return "unknown"
    83  }