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

Function BenchmarkBindStruct

sqlx_test.go:1735–1749  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

1733}
1734
1735func BenchmarkBindStruct(b *testing.B) {
1736 b.StopTimer()
1737 q1 := `INSERT INTO foo (a, b, c, d) VALUES (:name, :age, :first, :last)`
1738 type t struct {
1739 Name string
1740 Age int
1741 First string
1742 Last string
1743 }
1744 am := t{"Jason Moiron", 30, "Jason", "Moiron"}
1745 b.StartTimer()
1746 for i := 0; i < b.N; i++ {
1747 bindStruct(DOLLAR, q1, am, mapper())
1748 }
1749}
1750
1751func TestBindNamedMapper(t *testing.T) {
1752 type A map[string]interface{}

Callers

nothing calls this directly

Calls 2

bindStructFunction · 0.85
mapperFunction · 0.85

Tested by

no test coverage detected