Documentation ¶
Index ¶
- Variables
- func CreateRow(connector gotabase.Connector, query string, args ...any) error
- func CreateRowWithId[TId any, T HasIdSetter[TId]](connector gotabase.Connector, object T, query string, args ...any) error
- func CreateRowWithScan[T any](connector gotabase.Connector, object T, ...) error
- func DeleteRow(connector gotabase.Connector, query string, args ...any) error
- func DeleteRows(connector gotabase.Connector, query string, args ...any) error
- func QueryRow[T any](connector gotabase.Connector, scanner func(row gotabase.Row) (*T, error), ...) (*T, error)
- func QueryRows[T any](connector gotabase.Connector, scanner func(row gotabase.Row) (*T, error), ...) ([]*T, error)
- func TryDelete(connector gotabase.Connector, query string, args ...any) error
- func UpdateRow(connector gotabase.Connector, query string, args ...any) error
- type HasIdSetter
Constants ¶
This section is empty.
Variables ¶
var Errors errorConfig
Functions ¶
func CreateRowWithId ¶
func CreateRowWithId[TId any, T HasIdSetter[TId]](connector gotabase.Connector, object T, query string, args ...any) error
CreateRowWithId creates a new data in the database. The query is expected to return a new id, that will be set in the object using the HasIdSetter interface method.
func CreateRowWithScan ¶
func CreateRowWithScan[T any](connector gotabase.Connector, object T, scanner func(row gotabase.Row, object T) error, query string, args ...any) error
CreateRowWithScan creates a new data in the database. The query is expected to return a row, that will match the provided scanner function.
func DeleteRow ¶
DeleteRow runs the query to remove a single row from the database. If none or more than one row are affected, then error will be returned.
func DeleteRows ¶
DeleteRows runs the query to remove at last one row from the database. If none or more than one row are affected, then error will be returned.
func QueryRow ¶
func QueryRow[T any](connector gotabase.Connector, scanner func(row gotabase.Row) (*T, error), query string, args ...any) (*T, error)
QueryRow is a helper function to run a single row query.
func QueryRows ¶
func QueryRows[T any](connector gotabase.Connector, scanner func(row gotabase.Row) (*T, error), query string, args ...any) ([]*T, error)
QueryRows is a helper function to run a multiple rows query based on a query string.
Types ¶
type HasIdSetter ¶
type HasIdSetter[T any] interface { SetId(id T) }