db

package
v0.0.0-...-eabe8e3 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CurrentTimestamp 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 string
	// 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 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