dependency

package
v0.0.0-...-70ec780 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseOption

type BaseOption struct {
	Ignore    bool     // ignore if exist
	Lock      bool     // lock row
	ReadOnly  bool     // read only
	Selects   []string // select fields
	Omits     []string // omit fields select omit
	Conds     []any    // conds where
	Page      IPage    // page
	BatchSize int64    // exec by batch
}

BaseOption base repo exec

type DbAction

type DbAction func(ctx context.Context) error

action

type IEntity

type IEntity interface {
	IPo
}

type IPage

type IPage interface {
	GetPageIndex() int64
	GetPageSize() int64
	GetBegin() int64
	GetSize() int64
	GetSorts() []ISortField
}

IPage page request

type IPaginator

type IPaginator interface {
	IPage
	GetTotalRecord() int64
	GetTotalPage() int64
}

type IPo

type IPo interface {
	ID() any
	TableName() string
	Database() string
}

IPo for db po struct

type IRepository

type IRepository[T IEntity] interface {
	BaseCreate(ctx context.Context, opt BaseOption, p ...T) (int64, error)
	BaseSave(ctx context.Context, opt BaseOption, p ...T) (int64, error)
	BaseUpdate(ctx context.Context, opt BaseOption, p T) (int64, error)
	BaseGet(ctx context.Context, opt BaseOption, p T) (int64, error)
	BaseDelete(ctx context.Context, opt BaseOption, p T) (int64, error)
	BaseCount(ctx context.Context, opt BaseOption, p T) (int64, error)
	BaseQuery(ctx context.Context, opt BaseOption, p T) ([]T, error)
}

IRepository repo

type ISortField

type ISortField interface {
	GetField() string
	GetIsDesc() bool
}

ISortField sort field

type IUnitOfWork

type IUnitOfWork interface {
	Execute(ctx context.Context, fs ...DbAction) (e error)
}

IUnitOfWork trans

Jump to

Keyboard shortcuts

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