db

package
v0.0.0-...-d5ce8da Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BooleanFalse string
View Source
var CurrentTimestamp string
View Source
var FnJSONGroupArray string
View Source
var FnJSONObject string

Functions

func Close

func Close() error

func Exec

func Exec(query string, args ...any) (sql.Result, error)

func Ping

func Ping()

func Query

func Query(query string, args ...any) (*sql.Rows, error)

func QueryRow

func QueryRow(query string, args ...any) *sql.Row

Types

type ConnectionURI

type ConnectionURI struct {
	*url.URL

	Dialect DBDialect
	// contains filtered or unexported fields
}

func ParseConnectionURI

func ParseConnectionURI(connection_uri string) (ConnectionURI, error)

func (ConnectionURI) DSN

func (uri ConnectionURI) DSN(mods ...DSNModifier) string

type DB

type DB struct {
	*sql.DB
	URI ConnectionURI
}

func Open

func Open() *DB

type DBDialect

type DBDialect string
const (
	DBDialectPostgres DBDialect = "postgres"
	DBDialectSQLite   DBDialect = "sqlite"
)
var Dialect DBDialect

type DSNModifier

type DSNModifier func(u *url.URL, q *url.Values)

type Timestamp

type Timestamp struct{ time.Time }

func (*Timestamp) Scan

func (t *Timestamp) Scan(value interface{}) error

func (*Timestamp) Value

func (t *Timestamp) Value() (driver.Value, error)

type Tx

type Tx struct {
	// contains filtered or unexported fields
}

func Begin

func Begin() (*Tx, error)

func (*Tx) Commit

func (tx *Tx) Commit() error

func (*Tx) Exec

func (tx *Tx) Exec(query string, args ...any) (sql.Result, error)

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL