Documentation
¶
Overview ¶
Package repository contains control entety repositories
Index ¶
- type AfterOption
- type GroupOption
- type ListOptions
- func (opts ListOptions) PrepareAfterQuery(query *gorm.DB, idCol string, orderColumns ...OrderingColumn) *gorm.DB
- func (opts ListOptions) PrepareQuery(query *gorm.DB) *gorm.DB
- func (opts ListOptions) With(prep QOption) ListOptions
- func (opts ListOptions) WithPermissions(ctx context.Context, defaultOpt QOption) (ListOptions, error)
- type OrderingColumn
- type OrderingColumnsOption
- type Pagination
- type PreloadOption
- type QOption
- type QueryPermissionAdjuster
- type Repository
- func (r *Repository) Leader(ctx context.Context) *gorm.DB
- 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) ReadOnly(ctx context.Context) *gorm.DB
- 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 ¶
This section is empty.
Types ¶
type AfterOption ¶ added in v0.1.1
type AfterOption interface {
PrepareAfterQuery(query *gorm.DB, idCol string, orderColumns []OrderingColumn) *gorm.DB
}
AfterOption prepare query after
type GroupOption ¶
type GroupOption struct {
Groups []string
SummingFields []string
// Additiona data for the technical use if need to save some information for later use
Ext any
}
func (*GroupOption) PrepareQuery ¶
func (opt *GroupOption) PrepareQuery(query *gorm.DB) *gorm.DB
type ListOptions ¶
type ListOptions []QOption
ListOptions for query preparation
func (ListOptions) PrepareAfterQuery ¶ added in v0.1.1
func (opts ListOptions) PrepareAfterQuery(query *gorm.DB, idCol string, orderColumns ...OrderingColumn) *gorm.DB
func (ListOptions) PrepareQuery ¶
func (opts ListOptions) PrepareQuery(query *gorm.DB) *gorm.DB
func (ListOptions) With ¶
func (opts ListOptions) With(prep QOption) ListOptions
func (ListOptions) WithPermissions ¶ added in v0.4.0
func (opts ListOptions) WithPermissions(ctx context.Context, defaultOpt QOption) (ListOptions, error)
WithPermissions finds the first QOption implementing QueryPermissionAdjuster and calls it. If no such option is found, appends defaultOpt and adjusts it. Returns the (possibly extended) opts slice and any adjustment error.
type OrderingColumn ¶ added in v0.1.1
type OrderingColumnsOption ¶ added in v0.1.2
type OrderingColumnsOption interface {
OrderingColumns() []OrderingColumn
}
type Pagination ¶
Pagination of the objects list
func (*Pagination) PrepareAfterQuery ¶ added in v0.1.1
func (p *Pagination) PrepareAfterQuery(q *gorm.DB, idCol string, orderColumns []OrderingColumn) *gorm.DB
PrepareAfterQuery prepare query with pagination Requered gorm plugin to support with clause
@plugin extraClausePlugin "github.com/WinterYukky/gorm-extra-clause-plugin" db.Use(extraClausePlugin.New())
func (*Pagination) PrepareQuery ¶
func (p *Pagination) PrepareQuery(q *gorm.DB) *gorm.DB
PrepareQuery prepare query with pagination
type PreloadOption ¶
type PreloadOption struct {
Fields []string
}
func (*PreloadOption) PrepareQuery ¶
func (opt *PreloadOption) PrepareQuery(query *gorm.DB) *gorm.DB
type QueryPermissionAdjuster ¶ added in v0.4.0
type Repository ¶
type Repository struct{}
Repository with basic functionality
func (*Repository) Leader ¶ added in v0.2.7
func (r *Repository) Leader(ctx context.Context) *gorm.DB
Leader returns master database executor
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) ReadOnly ¶ added in v0.2.7
func (r *Repository) ReadOnly(ctx context.Context) *gorm.DB
ReadOnly returns readonly database connection
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 |
|---|---|
|
delivery/graphql/account_login
Package accountlogin provides the email+password login mutation as a schema extension.
|
Package accountlogin provides the email+password login mutation as a schema extension. |
|
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
|
usecase
Package usecase account implementation
|
Package usecase account implementation |
|
Package authclient provides repository access for authentication client management.
|
Package authclient provides repository access for authentication client management. |
|
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 |
|
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
|
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 presents full API functionality of the specific object.
|
Package option presents 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 provides business logic for option management
|
Package usecase provides business logic for option management |
|
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 provides business logic for RBAC role management
|
Package usecase provides business logic for RBAC role management |
|
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. |
|
usecase
Package usecase user managing
|
Package usecase user managing |