db

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteQuery

func ExecuteQuery(data map[string]any, opts ...Option) (map[string]any, error)

Types

type Callback

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

type Option

type Option func(*Callback)

func WithAfter

func WithAfter(f func(result *Result)) Option

func WithBefore

func WithBefore(f func(query string, params []any)) Option

type Req

type Req struct {
	Driver  string `map:"driver"`
	DSN     string `map:"dsn"`
	Query   string `map:"query"`
	Params  []any  `map:"params"`
	Timeout string `map:"timeout"`
	// contains filtered or unexported fields
}

func ParseRequest

func ParseRequest(with map[string]any) (*Req, string, time.Duration, error)

func (*Req) Execute

func (r *Req) Execute(driverDSN string, timeout time.Duration) (res map[string]any, err error)

type Res

type Res struct {
	Code         int    `map:"code"`
	RowsAffected int64  `map:"rows_affected"`
	Rows         []any  `map:"rows"`
	Error        string `map:"error"`
}

type Result

type Result struct {
	Req    Req           `map:"req"`
	Res    Res           `map:"res"`
	RT     time.Duration `map:"rt"`
	Status int           `map:"status"`
}

Jump to

Keyboard shortcuts

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