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
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
type OptionType ¶ added in v0.4.0
type OptionType = models.OptionType
OptionType defines the type of the option, such as user, project, etc.
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 |
Click to show internal directories.
Click to hide internal directories.