database

package
v2.0.0-...-fe53531 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrInvalidInput     = errors.Sentinel("invalid input")
	ErrNotFound         = errors.Sentinel("not found")
	ErrDatabaseIsLocked = errors.Sentinel("database is locked")
)

Variables

This section is empty.

Functions

func Migrate

func Migrate(db *gorm.DB) error

Types

type Condition

type Condition struct {
	Key      string
	Operator string
	Value    string
}

type FileStoreConfig

type FileStoreConfig struct {
	CleanupAfter time.Duration
}

type ListOption

type ListOption interface {
	ApplyToList(*ListOptions)
}

func ApplyFilters

func ApplyFilters(filters fileserver.Filters) ListOption

func Paginate

func Paginate(pageToken string, pageSize int) ListOption

func ShowDeleted

func ShowDeleted() ListOption

type ListOptions

type ListOptions struct {
	Pagination  *ListPagination
	ShowDeleted bool
	Filters     fileserver.Filters
}

func (*ListOptions) ApplyOptions

func (o *ListOptions) ApplyOptions(opts []ListOption) *ListOptions

type ListPagination

type ListPagination struct {
	Page, PageSize int
}

func (ListPagination) ApplyToList

func (l ListPagination) ApplyToList(opts *ListOptions)

type SortOrder

type SortOrder struct {
	Key   string
	Order string
}

type StoredFileStore

type StoredFileStore interface {
	List(ctx context.Context, opts ...ListOption) (files []modelsv2.StoredFile, nextPageToken string, err error)
	Get(ctx context.Context, id string) (*modelsv2.StoredFile, error)
	GetByFileKey(ctx context.Context, fileKey *modelsv2.StoredFileKey) (*modelsv2.StoredFile, error)
	Save(ctx context.Context, file *modelsv2.StoredFile) (id string, err error)
	Delete(ctx context.Context, id string, permanent bool) error
	Download(ctx context.Context, id string) (*modelsv2.StoredFile, error)
	CleanTombstones(ctx context.Context) (int64, error)
}

func New

func New(db *gorm.DB, config FileStoreConfig) (StoredFileStore, io.Closer)

Jump to

Keyboard shortcuts

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