persistence

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is the error returned if a resource cannot be found.
	ErrNotFound = errors.New("not found error")

	// ErrNotValid is the error returned if the data provided is invalid.
	ErrNotValid = errors.New("invalid data error")

	// ErrInternal is the error returned if an internal error occurred.
	ErrInternal = errors.New("internal error")
)

Functions

func WithTelemetry

func WithTelemetry(wrapped Service, tracer trace.Tracer) *wrapper

WithTelemetry enriches Service by adding instrumentation and context.

Types

type Page

type Page struct {
	// Limit is the maximum number of results per page.
	Limit int

	// Offset is the ordinal position, relative to the start of the unfiltered
	// set, of the first result of the page.
	Offset int

	// Total is the total number of search results before paging.
	Total int
}

Page represents a subset of results within a search result set.

func (*Page) Goa

func (p *Page) Goa() *goaingest.EnduroPage

type SIPFilter added in v0.10.0

type SIPFilter struct {
	// Name filters for SIPs whose names contain the given string.
	Name *string

	AIPID      *uuid.UUID
	Status     *enums.SIPStatus
	CreatedAt  *timerange.Range
	UploaderID *uuid.UUID

	entfilter.Sort
	Page
}

type SIPUpdater added in v0.10.0

type SIPUpdater func(*datatypes.SIP) (*datatypes.SIP, error)

type Service

type Service interface {
	// CreateSIP persists the given SIP to the data store then updates
	// the SIP from the data store, adding auto-generated data
	// (e.g. ID, CreatedAt).
	CreateSIP(context.Context, *datatypes.SIP) error
	UpdateSIP(context.Context, uuid.UUID, SIPUpdater) (*datatypes.SIP, error)
	DeleteSIP(context.Context, int) error
	ReadSIP(context.Context, uuid.UUID) (*datatypes.SIP, error)
	ListSIPs(context.Context, *SIPFilter) ([]*datatypes.SIP, *Page, error)

	CreateWorkflow(context.Context, *datatypes.Workflow) error

	CreateTask(context.Context, *datatypes.Task) error
	UpdateTask(ctx context.Context, id int, updater TaskUpdater) (*datatypes.Task, error)

	// CreateUser persists a new user to the data store then updates the user
	// to add auto-generated data (e.g. ID, CreatedAt).
	CreateUser(context.Context, *datatypes.User) error

	// ReadUser retrieves a user by UUID.
	ReadUser(context.Context, uuid.UUID) (*datatypes.User, error)

	// ReadOIDCUser retrieves a user by OIDC issuer and subject.
	ReadOIDCUser(ctx context.Context, iss, sub string) (*datatypes.User, error)

	// ListUsers retrieves a list of users based on the provided filter.
	ListUsers(context.Context, *UserFilter) ([]*datatypes.User, *Page, error)
}

type TaskUpdater added in v0.12.0

type TaskUpdater func(*datatypes.Task) (*datatypes.Task, error)

type UserFilter added in v0.15.0

type UserFilter struct {
	CreatedAt *timerange.Range
	Email     *string
	Name      *string

	entfilter.Sort
	Page
}

Directories

Path Synopsis
ent
db
Package fake is a generated GoMock package.
Package fake is a generated GoMock package.

Jump to

Keyboard shortcuts

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