universally

package
v1.3.0-beta Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SoftDeleteField = "is_delete"
	SoftDeleteWhere = "is_delete = false"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IServiceCreate

type IServiceCreate[INPUT any] interface {
	Create(ctx context.Context, input *INPUT, appendLabels ...string) (err error)
}

func NewCreator

func NewCreator[INPUT any, E any](st store.ISearchStore[E], name string, createEntityHandler func(i *INPUT) *E, uniquestHandler func(*INPUT) []map[string]any, labelHandler ...func(*E) []string) IServiceCreate[INPUT]

func NewCreatorSoftDelete

func NewCreatorSoftDelete[INPUT any, E any](st store.ISearchStore[E], name string, createEntityHandler func(i *INPUT) *E, uniquestHandler func(*INPUT) []map[string]any, labelHandlers ...func(*E) []string) IServiceCreate[INPUT]

type IServiceDelete

type IServiceDelete interface {
	Delete(ctx context.Context, uuid string) error
}

func NewDelete

func NewDelete[E any](store store.ISearchStore[E]) IServiceDelete

func NewSoftDelete

func NewSoftDelete[E any](s store.ISearchStore[E]) IServiceDelete

type IServiceEdit

type IServiceEdit[INPUT any] interface {
	Save(ctx context.Context, id string, model *INPUT, appendLabels ...string) error
}

func NewEdit

func NewEdit[INPUT any, E any](st store.ISearchStore[E], updateHandler func(e *E, model *INPUT), labels ...func(model *E) []string) IServiceEdit[INPUT]

type IServiceGet

type IServiceGet[T any] interface {
	Get(ctx context.Context, uuid string) (*T, error)
	List(ctx context.Context, uuids ...string) ([]*T, error)

	Search(ctx context.Context, keyword string, condition map[string]interface{}, sortRule ...string) ([]*T, error)
	Count(ctx context.Context, keyword string, condition map[string]interface{}) (int64, error)
	//CountByGroup(ctx context.Context, keyword string, condition map[string]interface{}, groupBy string) (map[string]int64, error)
	SearchByPage(ctx context.Context, keyword string, condition map[string]interface{}, page int, pageSize int, sortRule ...string) ([]*T, int64, error)
}

func NewGet

func NewGet[T any, E any](store store.ISearchStore[E], toModelHandler func(*E) *T) IServiceGet[T]

func NewGetSoftDelete

func NewGetSoftDelete[T any, E any](store store.ISearchStore[E], toModelHandler func(*E) *T) IServiceGet[T]

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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