option

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Overview

Package option presents full API functionality of the specific object.

Index

Constants

View Source
const (
	OrderUndefined = models.OrderUndefined
	OrderAsc       = models.OrderAsc
	OrderDesc      = models.OrderDesc
)
View Source
const (
	UndefinedOptionType = models.UndefinedOptionType
	UserOptionType      = models.UserOptionType
	AccountOptionType   = models.AccountOptionType
	SystemOptionType    = models.SystemOptionType
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter struct {
	Type        []optionModels.OptionType
	TargetID    []uint64
	Name        []string
	NamePattern []string
}

Filter of the objects list

func (*Filter) PrepareQuery

func (fl *Filter) PrepareQuery(q *gorm.DB) *gorm.DB

PrepareQuery returns the query with applied filters

type ListOptions added in v0.4.0

type ListOptions = repository.ListOptions

type ListOrder

type ListOrder struct {
	Name      optionModels.Order
	Type      optionModels.Order
	TargetID  optionModels.Order
	CreatedAt optionModels.Order
	UpdatedAt optionModels.Order
}

ListOrder object with order values which is not NULL

func (*ListOrder) PrepareQuery

func (ord *ListOrder) PrepareQuery(q *gorm.DB) *gorm.DB

PrepareQuery returns the query with applied order

type Option added in v0.4.0

type Option = models.Option

Option represents a single option in the system.

type OptionType added in v0.4.0

type OptionType = models.OptionType

OptionType defines the type of the option, such as user, project, etc.

type Order added in v0.4.0

type Order = models.Order

Order defines the sort direction.

type Pagination added in v0.4.0

type Pagination = repository.Pagination

type QOption added in v0.4.0

type QOption = repository.QOption

type Repository

type Repository interface {
	// Get retrieves a single option by name, type, and target ID.
	Get(ctx context.Context, name string, otype OptionType, targetID uint64) (*Option, error)

	// FetchList retrieves a list of options with filtering, ordering, and pagination.
	FetchList(ctx context.Context, opts ...QOption) ([]*Option, error)

	// Count returns the total number of options matching the filter.
	Count(ctx context.Context, opts ...QOption) (int64, error)

	// Set creates or updates an option.
	Set(ctx context.Context, opt *Option) error

	// Delete removes an option by name, type, and target ID.
	Delete(ctx context.Context, name string, otype OptionType, targetID uint64) error
}

Repository provides access to options with CRUD operations.

type Usecase

type Usecase interface {
	// Get retrieves a single option by name, type, and target ID.
	Get(ctx context.Context, name string, otype OptionType, targetID uint64) (*Option, error)

	// FetchList retrieves a list of options filtered, ordered, and paginated according to the parameters.
	FetchList(ctx context.Context, opts ...QOption) ([]*Option, error)

	// Count returns the total number of options matching the filter criteria.
	Count(ctx context.Context, opts ...QOption) (int64, error)

	// Set stores or updates an option.
	Set(ctx context.Context, opt *Option) error

	// SetOption stores or updates an option by name, type, target ID, and value.
	SetOption(ctx context.Context, name string, otype OptionType, targetID uint64, value any) error

	// Delete removes an option by name, type, and target ID.
	Delete(ctx context.Context, name string, otype OptionType, targetID uint64) error
}

Usecase defines operations for managing options in the system.

Directories

Path Synopsis
delivery
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package repository implements methods of working with the repository objects
Package repository implements methods of working with the repository objects
Package usecase provides business logic for option management
Package usecase provides business logic for option management

Jump to

Keyboard shortcuts

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