mysqlt

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectSimpleTCP added in v1.5.0

func ConnectSimpleTCP(login, password, addr, database string) (*sql.DB, error)

ConnectSimpleTCP performs simple connection over TCP to requested address and database

func GetByID

func GetByID[T any](getter sqlt.Getter, table string, id any) (*T, error)

GetByID reads single entity from database

func In

func In(values ...any) (string, []any)

In constructs SQL query chunk and arguments slice

func InString

func InString(values ...string) (string, []any)

InString constructs SQL query chunk and arguments slice

func InUint64

func InUint64(values ...uint64) (string, []any)

InUint64 constructs SQL query chunk and arguments slice

func Insert

func Insert(exec sqlt.Executor, table string, values map[string]any) (sql.Result, error)

Insert places values map into database

func InspectColumns added in v1.4.0

func InspectColumns(db sqlt.Querier, table string) ([]inspect.Column, error)

InspectColumns reads columns data for given table

func MakeGenericListReader added in v1.6.0

func MakeGenericListReader[I, T any](db sqlt.Reader, table, column string) sqlt.GenericListReader[I, T]

MakeGenericListReader constructs accessor to database table able to match records by single column value (like id).

func MakeGenericReader added in v1.6.0

func MakeGenericReader[I, T any](db sqlt.Reader, table, column string) sqlt.GenericReader[I, T]

MakeGenericReader constructs accessor to database table able to match single record by single column value (like id).

func MakeGetByID

func MakeGetByID[T any, I any](getter sqlt.Getter, table string) func(I) (*T, error)

MakeGetByID constructs function that reads single entity from database

func MakeInsert

func MakeInsert[IN any, OUT any](
	exec sqlt.Executor,
	table string,
	mapIn func(IN) (map[string]any, error),
	mapOut func(sql.Result) (OUT, error),
) func(IN) (OUT, error)

MakeInsert constructs function that places values into database

func MakeSelectByID

func MakeSelectByID[T any, I any](selector sqlt.Selector, table string) func(...I) ([]T, error)

MakeSelectByID constructs function that reads multiple entities by identifiers

func Name

func Name(s string) string

Name performs table/column name escaping.

func SelectByID

func SelectByID[T any](selector sqlt.Selector, table string, id ...any) (out []T, err error)

SelectByID reads multiple entities by identifiers

func Update

func Update(exec sqlt.Executor, table string, values map[string]any, condition string, iargs ...any) (sql.Result, error)

Update performs database modification query

Types

This section is empty.

Jump to

Keyboard shortcuts

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