repositories

package
v0.0.0-...-4bd82ba Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BankRepositoryFilter

type BankRepositoryFilter struct {
	Keyword string
	// contains filtered or unexported fields
}

type IBankRepository

type IBankRepository interface {
	GetBankList(ctx context.Context, filter *BankRepositoryFilter) ([]entities.Bank, error)
}

type IOauthAccessTokenRepository

type IOauthAccessTokenRepository interface {
	IRepository
}

type IOauthAuthCodeRepository

type IOauthAuthCodeRepository interface {
	FindByCode(code string)
}

type IOauthClientRepository

type IOauthClientRepository interface {
	ITransactionRepository
	FindByClientIdAndClientSecret(ctx context.Context, clientId, clientSecret string) (*entities.OauthClient, errors.DomainError)
}

type IRepository

type IRepository interface {
	FindAll(ctx context.Context, target interface{}, preloads ...string) errors.DomainError
	FindBatch(ctx context.Context, target interface{}, limit, offset int, preloads ...string) errors.DomainError

	FindWhere(ctx context.Context, target interface{}, condition string, preloads ...string) errors.DomainError
	FindWhereBatch(ctx context.Context, target interface{}, condition string, limit, offset int, preloads ...string) errors.DomainError

	FindByField(ctx context.Context, target interface{}, field string, value interface{}, preloads ...string) errors.DomainError
	FindByFields(ctx context.Context, target interface{}, filters map[string]interface{}, preloads ...string) errors.DomainError
	FindByFieldBatch(ctx context.Context, target interface{}, field string, value interface{}, limit, offset int, preloads ...string) errors.DomainError
	FindByFieldsBatch(ctx context.Context, target interface{}, filters map[string]interface{}, limit, offset int, preloads ...string) errors.DomainError

	FindOneByField(ctx context.Context, target interface{}, field string, value interface{}, preloads ...string) errors.DomainError
	FindOneByFields(ctx context.Context, target interface{}, filters map[string]interface{}, preloads ...string) errors.DomainError

	// FindOneByID assumes you have a PK column "id" which is a UUID. If this is not the case just ignore the method
	// and add a custom struct with this IRepository embedded.
	FindOneByID(ctx context.Context, target interface{}, id string, preloads ...string) errors.DomainError

	Create(ctx context.Context, target interface{}) errors.DomainError
	Save(ctx context.Context, target interface{}) errors.DomainError
	Delete(ctx context.Context, target interface{}) errors.DomainError

	DBGorm() *gorm.DB
	DBWithPreloads(preloads []string) *gorm.DB
	HandleQueryError(res *gorm.DB) errors.DomainError
	HandleCommandError(res *gorm.DB) errors.DomainError
	HandleOneError(res *gorm.DB) errors.DomainError
}

IRepository is a generic DB handler that cares about default error handling

type ITransactionRepository

type ITransactionRepository interface {
	IRepository
	CreateTx(ctx context.Context, target interface{}, tx *gorm.DB) errors.DomainError
	SaveTx(ctx context.Context, target interface{}, tx *gorm.DB) errors.DomainError
	DeleteTx(ctx context.Context, target interface{}, tx *gorm.DB) errors.DomainError
}

ITransactionRepository extends IRepository with modifier functions that accept a transaction

Jump to

Keyboard shortcuts

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