123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- package sqlite
- import "time"
- func SQLType(ftype string) string {
- switch ftype {
- case "map", "set", "list":
- return "blob"
- case "bucket":
- return "blob"
- case "relation":
- return "blob"
- }
- return ftype
- }
- func defaultvalue(ftype string) any {
- switch ftype {
- case "text":
- return ""
- case "varchar":
- return ""
- case "string":
- return ""
- case "bool":
- return false
- case "boolean":
- return false
- case "int":
- return 0
- case "smallint":
- return int16(0)
- case "enum":
- return int16(0)
- case "bigint":
- return int64(0)
- case "float":
- return float32(0)
- case "double":
- return float64(0)
- case "date":
- return "1970-01-01"
- case "timestamp":
- return time.Time{}.UnixNano() / 1e6
- case "map":
- return []byte{}
- case "set":
- return []byte{}
- case "list":
- return []byte{}
- case "bucket":
- return []byte{}
- case "relation":
- return []byte{}
- }
- return nil
- }
|