types

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: Apache-2.0 Imports: 2 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppServer

type AppServer interface {
	Start() error                               // 开始
	Stop(forced ...bool) error                  // 默认为优雅关闭, 如果forced为true, 则强制关闭
	HookPreStart(fns ...HookFunction) AppServer // 添加启动前的钩子函数
	HookPreStop(fns ...HookFunction) AppServer  // 添加停止前的钩子函数
}

type BulkOperateObjectRequest

type BulkOperateObjectRequest[TObjectKey ObjectKeyType] struct {
	Keys []TObjectKey `json:"keys"`
}

type CreateObjectResponse

type CreateObjectResponse[TObjectId ObjectKeyType] struct {
	Id TObjectId `json:"id"`
}

type CreateRefObjectRequest

type CreateRefObjectRequest[TObjectKey ObjectKeyType, TBizObject any] struct {
	Key  TObjectKey `json:"key"`
	Item TBizObject `json:"item"`
}

type DbBulkRetrieve

type DbBulkRetrieve[TObjectKey ObjectKeyType, ModelObject any] interface {
	BulkGet(ids []TObjectKey) (map[TObjectKey]ModelObject, error) // 批量获取对象
}

DbBulkRetrieve 批量读取

type DbCreate

type DbCreate[BizObject any, ModelObject any] interface {
	Create(bizObj BizObject) (ModelObject, error) // 创建对象
}

DbCreate 创建操作:C

type DbDelete

type DbDelete[TObjectKey ObjectKeyType] interface {
	Delete(key TObjectKey) error // 删除对象
}

DbDelete 删除

type DbEdit

type DbEdit[TBizObject any] interface {
	Edit(bizObj TBizObject) error // 编辑对象
}

type DbOperation

type DbOperation[TObjectKey ObjectKeyType, TBizObject any, TModelObject any, TCondition any] interface {
	DbCreate[TBizObject, TModelObject]
	DbRetrieve[TObjectKey, TModelObject, TCondition]
	DbUpdate[TModelObject]
	DbDelete[TObjectKey]
}

type DbRetrieve

type DbRetrieve[TObjectKey ObjectKeyType, TModelObject any, TCondition any] interface {
	Get(key TObjectKey) (TModelObject, error)                                            // 获取对象
	Count(filters map[string]string) (int64, error)                                      // 统计对象
	List(filters map[string]string, list ...*protobuf.ListParam) ([]TModelObject, error) // 列出对象, list不传的时候获取所有对象
	GetQueryConditions(filters map[string]string) []TCondition                           // 获取查询条件
}

DbRetrieve 读操作

type DbUpdate

type DbUpdate[TModelObject any] interface {
	Update(modelObj TModelObject) error // 更新某个字段
}

DbUpdate 更新:U

type DeleteRefObjectRequest

type DeleteRefObjectRequest[TObjectKey ObjectKeyType] struct {
	Key     TObjectKey `json:"key"`
	ItemKey TObjectKey `json:"itemKey"`
}

type EditRefObjectRequest

type EditRefObjectRequest[TObjectKey ObjectKeyType, TBizObject any] struct {
	Key  TObjectKey `json:"key"`
	Item TBizObject `json:"item"`
}

type GetRefObjectRequest

type GetRefObjectRequest[TObjectKey ObjectKeyType] struct {
	Key     TObjectKey `json:"key"`
	ItemKey TObjectKey `json:"itemKey"`
}

type HookFunction

type HookFunction func() error

type ObjectKeyType added in v0.0.11

type ObjectKeyType interface {
	int64 | int32 | int | string
}

type OperateObjectRequest

type OperateObjectRequest[TObjectKey ObjectKeyType] struct {
	Key TObjectKey `json:"key"`
}

type QueryObjectRequest

type QueryObjectRequest struct {
	Filters map[string]string   `json:"filters,omitempty"`
	List    *protobuf.ListParam `json:"list,omitempty"`
}

type QueryObjectResponse

type QueryObjectResponse[TBizObject any] struct {
	Total int64        `json:"total"`
	Items []TBizObject `json:"items"`
}

type QueryRefObjectRequest

type QueryRefObjectRequest[TObjectKey ObjectKeyType] struct {
	Key     TObjectKey          `json:"key"`
	Filters map[string]string   `json:"filters,omitempty"`
	List    *protobuf.ListParam `json:"list,omitempty"`
}

type QueryRefObjectResponse

type QueryRefObjectResponse[TBizObject any] struct {
	Total int64        `json:"total"`
	Items []TBizObject `json:"items"`
}

type RefDbBulkRetrieve

type RefDbBulkRetrieve[TObjectKey ObjectKeyType, TRefModelObject any] interface {
	BulkGet(key TObjectKey, refKeys []TObjectKey) (map[TObjectKey]TRefModelObject, error) // 批量获取对象
}

RefDbBulkRetrieve 批量读取关联对象

type RefDbCreate

type RefDbCreate[TObjectKey ObjectKeyType, TRefBizObject any, TRefModelObject any] interface {
	Create(key TObjectKey, refBizObj TRefBizObject) (TRefModelObject, error) // 创建关联对象DAO
}

RefDbCreate 创建关联对象操作:C

type RefDbDelete

type RefDbDelete[TObjectKey ObjectKeyType] interface {
	Delete(key, refKey TObjectKey) error // 删除关联对象DAO
}

RefDbDelete 删除关联对象

type RefDbEdit

type RefDbEdit[TObjectKey ObjectKeyType, TRefBizObject any] interface {
	Edit(key TObjectKey, refBizObj TRefBizObject) error // 编辑数据库关联对象DAO
}

type RefDbOperation

type RefDbOperation[TObjectKey ObjectKeyType, TRefBizObject any, TRefModelObject any, TCondition any] interface {
	RefDbCreate[TObjectKey, TRefBizObject, TRefModelObject]
	RefDbRetrieve[TObjectKey, TRefModelObject, TCondition]
	RefDbUpdate[TRefModelObject]
	RefDbDelete[TObjectKey]
}

type RefDbRetrieve

type RefDbRetrieve[TObjectKey ObjectKeyType, TRefModelObject any, Condition any] interface {
	Get(key, refKey TObjectKey) (TRefModelObject, error)                                                          // 获取关联对象DAO
	Count(key TObjectKey, refObjFilters map[string]string) (int64, error)                                         // 统计关联对象DAO
	List(key TObjectKey, refObjFilters map[string]string, list ...*protobuf.ListParam) ([]TRefModelObject, error) // 列出关联对象DAO
	GetQueryConditions(key TObjectKey, refObjFilters map[string]string) []Condition                               // 获取关联对象DAO
}

RefDbRetrieve 读取关联对象操作:R

type RefDbUpdate

type RefDbUpdate[TRefObjectModel any] interface {
	Update(refObjModel TRefObjectModel) error // 更新数据库关联对象
}

RefDbUpdate 更新关联对象:U

type ServiceCreate

type ServiceCreate[TBizObject any] interface {
	Create(ctx context.Context, object TBizObject) (int64, error) // 创建业务对象
}

type ServiceDelete

type ServiceDelete[TObjectKey ObjectKeyType] interface {
	Delete(ctx context.Context, key TObjectKey) error // 删除业务对象
}

type ServiceGet added in v0.0.11

type ServiceGet[TObjectKey ObjectKeyType, TBizObject any] interface {
	Get(ctx context.Context, key TObjectKey) (TBizObject, error) // 获取业务对象
}

type ServiceOperation

type ServiceOperation[TObjectKey ObjectKeyType, TBizObject any] interface {
	ServiceCreate[TBizObject]
	ServiceRetrieve[TObjectKey, TBizObject]
	ServiceUpdate[TBizObject]
	ServiceDelete[TObjectKey]
}

type ServiceQuery added in v0.0.11

type ServiceQuery[TBizObject any] interface {
	Query(ctx context.Context, filters map[string]string, list ...*protobuf.ListParam) (int64, []TBizObject, error) // 查询业务对象
}

type ServiceRetrieve

type ServiceRetrieve[TObjectKey ObjectKeyType, TBizObject any] interface {
	ServiceGet[TObjectKey, TBizObject]
	ServiceQuery[TBizObject]
}

type ServiceUpdate

type ServiceUpdate[TBizObject any] interface {
	Edit(ctx context.Context, bizObject TBizObject) error // 编辑业务对象
}

Jump to

Keyboard shortcuts

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