model

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ExampleModelWireSet = wire.NewSet(NewExampleModel)
)

Functions

func GetExampleModelWireSet

func GetExampleModelWireSet() wire.ProviderSet

func GetKeyExampleModel

func GetKeyExampleModel(ns ...string) string

GetKeyExampleModel 获取模型注册key

func RegisterKeyExampleModel

func RegisterKeyExampleModel(ctx frame.ContextFramer, ns ...string) string

RegisterKeyExampleModel 注册模型到容器(延迟初始化)并返回注册key

Types

type ExampleModel

type ExampleModel struct {
	dbmongo.MongoLocator
	// contains filtered or unexported fields
}

ExampleModel Example模型,继承MongoLocator定位器接口,具备获取上下文、配置、日志、注册实例等功能 以及基本的mongodb操作能力

func NewExampleModel

func NewExampleModel(ctx frame.ContextFramer) *ExampleModel

func (*ExampleModel) DeleteExample

func (m *ExampleModel) DeleteExample(ctx context.Context, id bson.ObjectID) (bool, error)

DeleteExample 删除样例文档

func (*ExampleModel) GetExampleByID

func (m *ExampleModel) GetExampleByID(ctx context.Context, oid string) (*entity.Example, error)

GetExampleByID 根据ID获取样例文档

func (*ExampleModel) GetExamples

func (m *ExampleModel) GetExamples(ctx context.Context, page, size int) ([]entity.Example, error)

GetExamples 获取样例文档列表

func (*ExampleModel) SaveExample

func (m *ExampleModel) SaveExample(ctx context.Context, doc *entity.Example) (bson.ObjectID, error)

SaveExample 创建样例文档

func (*ExampleModel) SaveMany

func (m *ExampleModel) SaveMany(ctx context.Context, docs []interface{}) ([]interface{}, error)

SaveMany 创建多个样例文档

func (*ExampleModel) UpdateExample

func (m *ExampleModel) UpdateExample(ctx context.Context, upExample *entity.Example) (bool, error)

UpdateExample 更新样例文档

Jump to

Keyboard shortcuts

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