repository

package
v1.0.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 2 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BulkInserter

type BulkInserter[T any] interface {
	BulkInsert(context.Context, ...T) error
}

BulkInserter — интерфейс для массовой вставки сущностей.

type Comparable

type Comparable uint8

Comparable определяет операцию сравнения.

const (
	Eq   Comparable = iota // равно
	Neq                    // не равно
	Gt                     // больше
	Gte                    // больше или равно
	Lt                     // меньше
	Lte                    // меньше или равно
	LIKE                   // LIKE (поиск по шаблону)
	IN                     // IN (список значений)
)

Comparable — тип сравнения для фильтров.

func (Comparable) String

func (i Comparable) String() string

type Counter

type Counter interface {
	Count(context.Context, ...*Filter) (uint64, error)
}

Counter — интерфейс для подсчёта количества записей.

type Deleter

type Deleter interface {
	Delete(context.Context, ...*Filter) error
}

Deleter — интерфейс для удаления записей по фильтрам.

type Filter

type Filter struct {
	ColumnName string
	Value      any
	Comparable Comparable
}

Filter определяет условие фильтрации.

func NewFilter

func NewFilter(columnName string, value any, comparable Comparable) *Filter

NewFilter создаёт новый Filter.

type Finder

type Finder[T any] interface {
	Find(context.Context, ...*Filter) ([]T, error)
}

Finder — интерфейс для поиска записей по фильтрам.

type Inserter

type Inserter[T any] interface {
	Insert(context.Context, T) (T, error)
}

Inserter — интерфейс для вставки новой сущности.

type Page

type Page struct {
	Number uint64
	Limit  uint64
}

Page содержит параметры пагинации.

func NewPage

func NewPage(number uint64, limit uint64) *Page

NewPage создаёт новый Page.

type Pager

type Pager[T any] interface {
	Page(context.Context, *Page, []*Sort, ...*Filter) ([]T, error)
}

Pager — интерфейс для постраничного получения данных.

type Saver

type Saver[T any] interface {
	Save(context.Context, T) (T, error)
}

Saver — интерфейс для сохранения сущности. Объединяет Insert и Update, определяя операцию по наличию ID.

type Sort

type Sort struct {
	ColumnName string
	Direction  SortDirection
}

Sort определяет сортировку по одной колонке.

func NewSort

func NewSort(columnName string, direction SortDirection) *Sort

NewSort создаёт новый Sort.

type SortDirection

type SortDirection uint8

SortDirection представляет направление сортировки.

const (
	ASC  SortDirection = iota // По возрастанию
	DESC                      // По убыванию
)

SortDirection — направление сортировки.

func (SortDirection) String

func (i SortDirection) String() string

type Updater

type Updater[T any] interface {
	Update(context.Context, T) (T, error)
}

Updater — интерфейс для обновления существующей сущности.

Jump to

Keyboard shortcuts

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