Documentation ¶
Overview ¶
Package repository contains control entety repositories
Index ¶
- type AfterOption
- type GroupOption
- type ListOptions
- type OrderingColumn
- type OrderingColumnsOption
- type Pagination
- type PreloadOption
- type QOption
- 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 ¶
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 ¶
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
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
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 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 |
Click to show internal directories.
Click to hide internal directories.