Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Array ¶
Array converts value into Postgres Array
Valid values are slices or arrays of arbitrary depth with elements of type string, int, uint and float elements of any bit size Example: []int, [][]uint16, [2][2]int, []string
Example ¶
package main import ( "fmt" "github.com/embedfi/sqrl" "github.com/embedfi/sqrl/pg" ) func main() { sql, args, err := sqrl.Insert("posts"). Columns("content", "tags"). Values("Lorem Ipsum", pg.Array([]string{"foo", "bar"})). PlaceholderFormat(sqrl.Dollar). ToSql() if err != nil { panic(err) } fmt.Println(sql) fmt.Println(args) }
Output: INSERT INTO posts (content,tags) VALUES ($1,$2) [Lorem Ipsum {"foo","bar"}]
func JSONB ¶
JSONB converts value into Postgres JSONB
Example ¶
package main import ( "fmt" "github.com/embedfi/sqrl" "github.com/embedfi/sqrl/pg" ) func main() { sql, args, err := sqrl.Insert("posts"). Columns("content", "tags"). Values("Lorem Ipsum", pg.JSONB([]string{"foo", "bar"})). PlaceholderFormat(sqrl.Dollar). ToSql() if err != nil { panic(err) } fmt.Println(sql) fmt.Println(args) }
Output: INSERT INTO posts (content,tags) VALUES ($1,$2::jsonb) [Lorem Ipsum ["foo","bar"]]
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.