repository

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package repository contains control entety repositories

Index

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
}

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 OrderingColumn struct {
	Name string
	DESC bool
}

type OrderingColumnsOption added in v0.1.2

type OrderingColumnsOption interface {
	OrderingColumns() []OrderingColumn
}

type Pagination

type Pagination struct {
	After  string
	Offset int
	Page   int
	Size   int
}

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 QOption

type QOption interface {
	PrepareQuery(query *gorm.DB) *gorm.DB
}

QOption 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

func (r *Repository) Transaction(ctx context.Context) (*gorm.DB, context.Context, bool, error)

Transaction returns new or exists transaction executor

func (*Repository) TransactionExec

func (r *Repository) TransactionExec(ctx context.Context, fn func(ctx context.Context, tx *gorm.DB) error, dbs ...*gorm.DB) error

TransactionExec executes function in transaction

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

Jump to

Keyboard shortcuts

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