store

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: Apache-2.0, MIT Imports: 3 Imported by: ? modules, 0 packages

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

View Source
const (
	// RecordExistsErrorName is the name given to an error where the record
	// already exists in the store.
	RecordExistsErrorName = "RecordExists"
	// RecordNotFoundErrorName is the name given to an error where the record
	// is not found in the store.
	RecordNotFoundErrorName = "RecordNotFound"
	// InvalidArgumentErrorName is the name given to an error where an argument
	// passed to a store operation is invalid.
	InvalidArgumentErrorName = "InvalidArgument"
)

Variables

View Source
var (
	// ErrRecordExists is returned when a record already exists in the store.
	ErrRecordExists = errors.New(RecordExistsErrorName, "record already exists")
	// ErrRecordNotFound is returned when a record is not found in the store.
	ErrRecordNotFound = errors.New(RecordNotFoundErrorName, "record not found")
	// ErrInvalidArgument is returned when an argument passed to a store
	// operation is invalid.
	ErrInvalidArgument = errors.New(InvalidArgumentErrorName, "invalid argument")
)

Functions

func Collect

func Collect[T any](ctx context.Context, getPage GetPageFunc[T]) ([]T, error)

Types

type GetPageFunc

type GetPageFunc[T any] func(ctx context.Context, options PaginationConfig) (Page[T], error)

type Page

type Page[T any] struct {
	Cursor  *string
	Results []T
}

Page is a generic type representing a paginated response from the store.

type PaginationConfig

type PaginationConfig struct {
	// Cursor is an optional string that indicates where to start the page. This
	// is typically the ID of the last item from the previous page.
	Cursor *string
	// Limit is an optional integer that specifies the maximum number of items to
	// return in the page. If not provided, a default limit may be applied by the
	// implementation.
	Limit *int
}

type PaginationOption

type PaginationOption func(cfg *PaginationConfig)

func WithCursor

func WithCursor(cursor string) PaginationOption

func WithLimit

func WithLimit(limit int) PaginationOption

Directories

Path Synopsis
postgres
Package postgres provides a PostgreSQL-backed implementation of accesskey.Store.
Package postgres provides a PostgreSQL-backed implementation of accesskey.Store.
postgres
Package postgres provides a PostgreSQL-backed implementation of bucket.Store.
Package postgres provides a PostgreSQL-backed implementation of bucket.Store.
postgres
Package postgres provides a PostgreSQL-backed implementation of delegation.Store.
Package postgres provides a PostgreSQL-backed implementation of delegation.Store.
postgres
Package postgres provides a PostgreSQL-backed implementation of provider.Store.
Package postgres provides a PostgreSQL-backed implementation of provider.Store.
postgres
Package postgres provides a PostgreSQL-backed implementation of tenant.Store.
Package postgres provides a PostgreSQL-backed implementation of tenant.Store.

Jump to

Keyboard shortcuts

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