Documentation ¶
Overview ¶
Package repository contains control entety repositories
Index ¶
- func ListOptionsInit[F, O QueryPreparer](opts ...ListOption[F, O]) *listOptions[F, O]
- func PrepareListOptions[F, O QueryPreparer](db *gorm.DB, opts ...ListOption[F, O]) *gorm.DB
- type ListOption
- type ListOptions
- type Pagination
- type QueryPreparer
- type Repository
- func (r *Repository) Logger(ctx context.Context) *zap.Logger
- func (r *Repository) Master(ctx context.Context) *gorm.DB
- func (r *Repository) PermissionManager(ctx context.Context) *permissions.Manager
- func (r *Repository) Slave(ctx context.Context) *gorm.DB
- func (r *Repository) Transaction(ctx context.Context) (*gorm.DB, context.Context, bool, error)
- func (r *Repository) TransactionExec(ctx context.Context, fn func(ctx context.Context, tx *gorm.DB) error, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListOptionsInit ¶
func ListOptionsInit[F, O QueryPreparer](opts ...ListOption[F, O]) *listOptions[F, O]
ListOptionsInit initialize list options
func PrepareListOptions ¶
func PrepareListOptions[F, O QueryPreparer](db *gorm.DB, opts ...ListOption[F, O]) *gorm.DB
PrepareListOptions prepare query with options
Types ¶
type ListOption ¶
type ListOption[F, O QueryPreparer] func(*listOptions[F, O])
Option for list query
func WithFilter ¶
func WithFilter[F, O QueryPreparer](filter F) ListOption[F, O]
WithFilter option for list query
func WithOrder ¶
func WithOrder[F, O QueryPreparer](order O) ListOption[F, O]
WithOrder option for list query
func WithPagination ¶
func WithPagination[F, O QueryPreparer](page *Pagination) ListOption[F, O]
WithPagination option for list query
type ListOptions ¶
type ListOptions[F QueryPreparer, O QueryPreparer] []ListOption[F, O]
ListOptions for query preparation
func (ListOptions[F, O]) PrepareQuery ¶
func (opts ListOptions[F, O]) PrepareQuery(query *gorm.DB) *gorm.DB
func (ListOptions[F, O]) WithFilter ¶
func (opts ListOptions[F, O]) WithFilter(filter F) ListOptions[F, O]
func (ListOptions[F, O]) WithOrder ¶
func (opts ListOptions[F, O]) WithOrder(order O) ListOptions[F, O]
func (ListOptions[F, O]) WithPagination ¶
func (opts ListOptions[F, O]) WithPagination(page *Pagination) ListOptions[F, O]
type Pagination ¶
Pagination of the objects list
func (*Pagination) PrepareQuery ¶
func (p *Pagination) PrepareQuery(q *gorm.DB) *gorm.DB
PrepareQuery prepare query with pagination
type QueryPreparer ¶
QueryPreparer prepare query
type Repository ¶
type Repository struct{}
Repository with basic functionality
func (*Repository) Logger ¶
func (r *Repository) Logger(ctx context.Context) *zap.Logger
Logger returns logger object from context
func (*Repository) Master ¶
func (r *Repository) Master(ctx context.Context) *gorm.DB
Master returns master database executor TODO: rename to Leader
func (*Repository) PermissionManager ¶
func (r *Repository) PermissionManager(ctx context.Context) *permissions.Manager
PermissionManager returns permission-manager object from context
func (*Repository) Slave ¶
func (r *Repository) Slave(ctx context.Context) *gorm.DB
Slave returns readonly database connection TODO: rename to ReadOnly
func (*Repository) Transaction ¶
Transaction returns new or exists transaction executor
Directories ¶
Path | Synopsis |
---|---|
Package account present full API functionality of the specific object
|
Package account present full API functionality of the specific object |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
repository
Package repository implements methods of working with the repository objects
|
Package repository implements methods of working with the repository objects |
usecase
Package usecase account implementation
|
Package usecase account implementation |
Package account present full API functionality of the specific object
|
Package account present full API functionality of the specific object |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
repository
Package repository implements methods of working with the repository objects
|
Package repository implements methods of working with the repository objects |
usecase
Package usecase account implementation
|
Package usecase account implementation |
Package account present full API functionality of the specific object
|
Package account present full API functionality of the specific object |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
repository
Package repository implements methods of working with the repository objects
|
Package repository implements methods of working with the repository objects |
usecase
Package usecase account implementation
|
Package usecase account implementation |
Package option present full API functionality of the specific object
|
Package option present full API functionality of the specific object |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
repository
Package repository implements methods of working with the repository objects
|
Package repository implements methods of working with the repository objects |
usecase
Package usecase account implementation
|
Package usecase account implementation |
Package account present full API functionality of the specific object
|
Package account present full API functionality of the specific object |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
repository
Package repository implements methods of working with the repository objects
|
Package repository implements methods of working with the repository objects |
usecase
Package usecase account implementation
|
Package usecase account implementation |
Package user present full API functionality of the specific object
|
Package user present full API functionality of the specific object |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
repository
Package repository implements methods of working with the repository objects
|
Package repository implements methods of working with the repository objects |
usecase
Package usecase user managing
|
Package usecase user managing |