Documentation ¶
Index ¶
Constants ¶
View Source
const (
ErrEmptyResult = errors.Const("empty query result")
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Factory ¶
type Factory interface { // Storage - возвращает клиента базы данных Storage(dsn string) (Storage, error) }
Factory - абстрактная фабрика клиентов
type Iterator ¶
type Iterator interface { io.Closer // Next - перемещает курсор итератора на следующий элемент Next(ctx context.Context) bool // Err - возвращает ошибку итератора, если такая имела место Err() error // Decode приводит значение текущего элемента итерации к указанному типу Decode(result any) error }
Iterator интерфейс итератора по многоэлементному результату запроса
type Storage ¶
type Storage interface { io.Closer // Begin Стартует и возвращает новую транзакцию Begin(ctx context.Context, opts ...any) (transaction Transaction, err error) // Exec Выполняет запрос который ничего не возвращает Exec(ctx context.Context, query Query) (sql.Result, error) // Query - выполняет запрос производящий действия в базе, с возможностью вернуть произвольный результат Query(ctx context.Context, query Query, result any) error // Iterate возвращает итератор по результату запроса Iterate(ctx context.Context, query Query) (Iterator, error) }
type Transaction ¶
type Transaction interface { // Context - возвращает контекст транзакции Context() context.Context // Commit Фиксирует текущую транзакцию Commit(ctx context.Context) error // Rollback Откатывает текущую транзакцию Rollback(ctx context.Context) error }
Transaction интерфейс транзакции базы данных
Click to show internal directories.
Click to hide internal directories.