GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — sqlb/bind_facade.go at main · ubgo/sqlb

Expand file tree

/

bind_facade.go

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
32 lines (27 loc) · 1.51 KB
/

bind_facade.go

Copy path

File metadata and controls

32 lines (27 loc) · 1.51 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package sqlb
import (
"github.com/ubgo/sqlb/bind"
"github.com/ubgo/sqlb/stmt"
)
// Binding is a select or RETURNING item that carries a scan destination.
//
// It is an interface defined by the statement layer, which knows only that an
// item renders and may carry a target. That the target is a pointer into a
// caller variable is decided by the bind package, which is also where the
// concurrency warning lives, because it is the layer that captured the memory.
type Binding = stmt.Binding
// Bind pairs e with dst. The compiler rejects a dst whose type is not *T.
//
// The pointer is captured, not the value, and it lives as long as the query
// does. Two consequences worth knowing before they bite: Each writes every row
// through the same pointer, so a callback keeping a row must copy it; and a
// query built this way is NOT SAFE FOR CONCURRENT USE, because two goroutines
// would write through these pointers at once, which is a DATA RACE. Build the
// query where its destination lives. See One and ErrQueryInUse, and see
// github.com/ubgo/sqlb/scan for the strategy that returns values instead.
func Bind[T any](e Expr[T], dst *T) Binding { return bind.Bind[T](e, dst) }
// Bindings concatenates binding groups, which is how one query scans into
// structs owned by several packages that do not import each other.
func Bindings(groups ...[]Binding) []Binding { return bind.Bindings(groups...) }
// Targets returns the scan destinations of a binding list, in order.
func Targets(bs []Binding) []any { return bind.Targets(bs) }
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.