MCPcopy
hub / github.com/jmoiron/sqlx / mapper

Function mapper

sqlx.go:37–49  ·  view source on GitHub ↗

mapper returns a valid mapper using the configured NameMapper func.

()

Source from the content-addressed store, hash-verified

35
36// mapper returns a valid mapper using the configured NameMapper func.
37func mapper() *reflectx.Mapper {
38 mprMu.Lock()
39 defer mprMu.Unlock()
40
41 if mpr == nil {
42 mpr = reflectx.NewMapperFunc("db", NameMapper)
43 } else if origMapper != reflect.ValueOf(NameMapper) {
44 // if NameMapper has changed, create a new mapper
45 mpr = reflectx.NewMapperFunc("db", NameMapper)
46 origMapper = reflect.ValueOf(NameMapper)
47 }
48 return mpr
49}
50
51// isScannable takes the reflect.Type and the actual dest value and returns
52// whether or not it's Scannable. Something is scannable if:

Callers 9

isScannableFunction · 0.85
mapperForFunction · 0.85
NewDbFunction · 0.85
OpenFunction · 0.85
scanAllFunction · 0.85
BindNamedFunction · 0.85
NamedFunction · 0.85
TestBindStructFunction · 0.85
BenchmarkBindStructFunction · 0.85

Calls 1

NewMapperFuncFunction · 0.92

Tested by 2

TestBindStructFunction · 0.68
BenchmarkBindStructFunction · 0.68