Documentation
¶
Index ¶
- Constants
- func Connect(driver Driver, connString string) (*sqlx.DB, error)
- func Exec(db *sqlx.DB, query string, args ...any) (err error)
- func Get[T any](db *sqlx.DB, query string, args ...any) (t T, err error)
- func NamedExec(db *sqlx.DB, dest any, query string, args ...any) error
- func NamedExecReturning(db *sqlx.DB, dest any, query string, args ...any) error
- func Select[T any](db *sqlx.DB, query string, args ...any) (t T, err error)
- type Driver
- type GenerateQueriesOptions
- type GeneratedQueries
- type IntSlice
- type JsonObject
- type StringSlice
Constants ¶
View Source
const ( DriverSqlite = "sqlite" DriverPostgres = "postgres" )
Variables ¶
This section is empty.
Functions ¶
func NamedExecReturning ¶
Types ¶
type GenerateQueriesOptions ¶
type GeneratedQueries ¶
type GeneratedQueries struct {
CreateTable string
DropTable string
Select string
Insert string
Update string
Upsert string
Delete string
}
func GenerateQueries ¶
func GenerateQueries(opts GenerateQueriesOptions) (queries GeneratedQueries)
Uses the struct fields 'db' and 'dbtype' to auto generate most queries.
`AutoGeneratingCols` is a list of col names that are auto generated on INSERT or UPSERT, like 'BIGSERIAL', etc. These will be excluded from INSERT statements to let the database auto generate.
`PrimaryKeys` is a list of col names that are used to control what is done on an UPDATE query.
type JsonObject ¶
func (*JsonObject) Scan ¶
func (obj *JsonObject) Scan(src any) error
type StringSlice ¶
type StringSlice []string
func (*StringSlice) Scan ¶
func (s *StringSlice) Scan(src any) error
Click to show internal directories.
Click to hide internal directories.