# README
go-sqlla
Type safe, reflect free, generative SQL Builder
INSTALL
$ go install github.com/mackee/go-sqlla/v2/cmd/sqlla@latest
SYNOPSIS
person.go:
package table
//go:generate sqlla
//+table: person
type Person struct {
ID uint64 `db:"id"`
FirstName string `db:"first_name"`
LastName string `db:"last_name"`
}
Run generate:
$ ls
person.go
$ go generate
$ ls
person.go person_auto.go
Same package as the person.go:
import (
"database/sql"
"log"
_ "github.com/mattn/go-sqlite3"
)
func main() {
db, err := sql.Open("sqlite3", "./foo.db")
if err != nil {
log.Fatalf("failed connect database: %s", err)
}
q := NewPersonSQL().Select().ID(uint64(1))
query, args, err := q.ToSql()
if err != nil {
log.Fatalf("query build error: %s", err)
}
row := db.QueryRow(query, args...)
var id uint64
var firstName, lastName string
err = row.Scan(&id, &firstName, &lastName)
if err != nil {
log.Fatalf("query exec error: %s", err)
}
log.Printf("id=%d, first_name=%s, last_name=%s", id, firstName, lastName)
}
# Packages
No description provided by the author
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Constants
No description provided by the author
No description provided by the author
RowAffected results.
RowAffected results.
RowAffected results.
# Variables
No description provided by the author
No description provided by the author
No description provided by the author
Operator for equal.
Operator for greater.
Operator for greater equal.
Operator for is.
Operator for less.
Operator for less equal.
Operator for like.
Operator for not equal.
Operator for pgvector cosine distance.
Operator for pgvector hamming distance.
Operator for pgvector jaccard distance.
Operator for pgvector l1 distance.
Operator for pgvector l2 distance.
Operator for pgvector negative inner product.
No description provided by the author
# Structs
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Interfaces
DB is interface like *database/sql.DB.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Scanner is interface like *database/sql.Row.
# Type aliases
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
RowAffected is result of upsert.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author