database

package
v0.0.0-...-8451b87 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Db

type Db struct {
	Con *sql.DB // Database connection
}

func Connect

func Connect(cfg *config.Config) (*Db, error)

func (*Db) Exec

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

func (*Db) Query

func (db *Db) Query(query string, f func(*sql.Rows) error, params ...any) error

RunQuery executes query, then calls f on each row. It stops when there are no more rows or f returns a non-nil error.

func (*Db) QueryRow

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

Jump to

Keyboard shortcuts

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