sorm

package module
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountAll

func CountAll(ctx context.Context, db Querier, val interface{}) (int, error)

func CountWhere

func CountWhere(ctx context.Context, db Querier, val interface{}, where string, args ...interface{}) (int, error)

func CreateRecord

func CreateRecord(ctx context.Context, tx *sql.Tx, input interface{}) error

func DeleteRecord

func DeleteRecord(ctx context.Context, tx *sql.Tx, input interface{}) error

func FindAll

func FindAll(ctx context.Context, db Querier, out interface{}) error

func FindFirst

func FindFirst(ctx context.Context, db Querier, out interface{}) error

func FindFirstWhere

func FindFirstWhere(ctx context.Context, db Querier, out interface{}, where string, args ...interface{}) error

func FindWhere

func FindWhere(ctx context.Context, db Querier, out interface{}, where string, args ...interface{}) error

func ReplaceRecord

func ReplaceRecord(ctx context.Context, tx *sql.Tx, input interface{}) error

func SaveRecord

func SaveRecord(ctx context.Context, tx *sql.Tx, input interface{}) error

func SaveRecordWithTransaction

func SaveRecordWithTransaction(ctx context.Context, db *sql.DB, input interface{}) error

func ScanRows

func ScanRows(rows *sql.Rows, out interface{}) error

func SetParameterPrefix added in v1.2.0

func SetParameterPrefix(s string)

func SetQueryLogger added in v1.5.0

func SetQueryLogger(q QueryLogger)

func SetQueryLoggerFunc added in v1.5.0

func SetQueryLoggerFunc(fn QueryLoggerFunc)

func TableName

func TableName(v interface{}) string

Types

type AfterCreater added in v1.3.0

type AfterCreater interface {
	AfterCreate(ctx context.Context, tx *sql.Tx) error
}

type AfterDeleter added in v1.3.0

type AfterDeleter interface {
	AfterDelete(ctx context.Context, tx *sql.Tx) error
}

type AfterReplacer added in v1.3.0

type AfterReplacer interface {
	AfterReplace(ctx context.Context, tx *sql.Tx) error
}

type AfterSaver added in v1.3.0

type AfterSaver interface {
	AfterSave(ctx context.Context, tx *sql.Tx) error
}

type BeforeCreater

type BeforeCreater interface {
	BeforeCreate(ctx context.Context, tx *sql.Tx) error
}

type BeforeDeleter

type BeforeDeleter interface {
	BeforeDelete(ctx context.Context, tx *sql.Tx) error
}

type BeforeReplacer

type BeforeReplacer interface {
	BeforeReplace(ctx context.Context, tx *sql.Tx) error
}

type BeforeSaver

type BeforeSaver interface {
	BeforeSave(ctx context.Context, tx *sql.Tx) error
}

type OverrideScanner added in v1.4.0

type OverrideScanner interface {
	OverrideScan(names []string, out []sql.Scanner) error
}

type Querier

type Querier interface {
	ExecContext(ctx context.Context, s string, args ...interface{}) (sql.Result, error)
	QueryContext(ctx context.Context, s string, args ...interface{}) (*sql.Rows, error)
	QueryRowContext(ctx context.Context, s string, args ...interface{}) *sql.Row
}

type QueryLogger added in v1.5.0

type QueryLogger interface {
	LogQuery(query string, vars []interface{})
}

type QueryLoggerAfter added in v1.5.0

type QueryLoggerAfter interface {
	LogQueryAfter(query string, vars []interface{}, duration time.Duration, err error)
}

type QueryLoggerFunc added in v1.5.0

type QueryLoggerFunc func(query string, vars []interface{})

func (QueryLoggerFunc) LogQuery added in v1.5.0

func (f QueryLoggerFunc) LogQuery(query string, vars []interface{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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