MCPcopy Create free account
hub / github.com/araddon/qlbridge / Scan

Method Scan

datasource/datatypes.go:64–91  ·  view source on GitHub ↗
(src interface{})

Source from the content-addressed store, hash-verified

62}
63
64func (m *TimeValue) Scan(src interface{}) error {
65
66 var t time.Time
67 var dstr string
68 switch val := src.(type) {
69 case string:
70 dstr = val
71 case []byte:
72 dstr = string(val)
73 default:
74 return ErrNotDate
75 }
76 if dstr == "" {
77 *m = TimeValue(time.Time{})
78 return nil
79 }
80 t2, err := dateparse.ParseAny(dstr)
81 if err == nil {
82 *m = TimeValue(t2)
83 return nil
84 }
85 err = json.Unmarshal([]byte(dstr), &t)
86 if err == nil {
87 *m = TimeValue(t)
88 return nil
89 }
90 return err
91}
92
93func (m *JsonWrapper) MarshalJSON() ([]byte, error) { return *m, nil }
94

Callers 15

TestFileSelectSimpleFunction · 0.45
BenchmarkFileSqlWhereFunction · 0.45
TestJsonSelectSimpleFunction · 0.45
BenchmarkJsonSqlWhereFunction · 0.45
SetupMethod · 0.45
NextMethod · 0.45
PutMethod · 0.45
GetMethod · 0.45
TestSqlCsvDriverSimpleFunction · 0.45

Calls 2

TimeValueTypeAlias · 0.70
UnmarshalMethod · 0.45

Tested by 12

TestFileSelectSimpleFunction · 0.36
BenchmarkFileSqlWhereFunction · 0.36
TestJsonSelectSimpleFunction · 0.36
BenchmarkJsonSqlWhereFunction · 0.36
TestSqlCsvDriverSimpleFunction · 0.36
TestSqlCsvDriverSubQueryFunction · 0.36
TestSqlDbConnFailureFunction · 0.36
TestExecInsertFunction · 0.36
TestExecUpdateAndUpsertFunction · 0.36