attribute

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const BizId = "biz_id"

Variables

This section is empty.

Functions

This section is empty.

Types

type AttributeDto

type AttributeDto struct {
	KV []*AttributeKV
}

type AttributeKV

type AttributeKV struct {
	Key   string
	Value interface{}
}

type BatchAttribute

type BatchAttribute struct {
	BatchKv []*AttributeDto
}

type MgoAttribute

type MgoAttribute struct {
	// contains filtered or unexported fields
}

func NewMongoAttribute

func NewMongoAttribute(m *mongo.Database, c string) *MgoAttribute

func (*MgoAttribute) DeleteAllByBizId

func (s *MgoAttribute) DeleteAllByBizId(ctx context.Context, id string) (int64, error)

func (*MgoAttribute) DeleteAttributeByBizId

func (s *MgoAttribute) DeleteAttributeByBizId(ctx context.Context, id string, delKeys []string) (int64, error)

func (*MgoAttribute) GetAssetAttribute

func (s *MgoAttribute) GetAssetAttribute(ctx context.Context, id string) (map[string]interface{}, error)

func (*MgoAttribute) GetAttributeByBizId

func (s *MgoAttribute) GetAttributeByBizId(ctx context.Context, id string, path []string) (interface{}, error)

func (*MgoAttribute) ListByBizIds

func (s *MgoAttribute) ListByBizIds(ctx context.Context, ids []string) ([]map[string]interface{}, error)

func (*MgoAttribute) Page

func (s *MgoAttribute) Page(ctx context.Context, filter bson.D, p *Page) (PageResult, error)

func (*MgoAttribute) Save

func (s *MgoAttribute) Save(ctx context.Context, kv []*AttributeKV) (string, error)

func (*MgoAttribute) SaveBatch

func (s *MgoAttribute) SaveBatch(ctx context.Context, batchKv *BatchAttribute) ([]string, error)

func (*MgoAttribute) UpdateBatch

func (s *MgoAttribute) UpdateBatch(ctx context.Context, id string, dto *AttributeDto) (int64, error)

func (*MgoAttribute) UpdateOneByBizId

func (s *MgoAttribute) UpdateOneByBizId(ctx context.Context, id string, m *AttributeDto) (int64, error)

func (*MgoAttribute) UseCollection

func (s *MgoAttribute) UseCollection(c string) *MgoAttribute

type MgoAttributeBackup

type MgoAttributeBackup struct {
	// contains filtered or unexported fields
}

func NewMongoBackAttribute

func NewMongoBackAttribute(m *mongo.Database, c string) *MgoAttributeBackup

func (*MgoAttributeBackup) DeleteAllById

func (s *MgoAttributeBackup) DeleteAllById(ctx context.Context, id string) (int64, error)

func (*MgoAttributeBackup) DeleteAttributeById

func (s *MgoAttributeBackup) DeleteAttributeById(ctx context.Context, id string, delKeys []string) (int64, error)

func (*MgoAttributeBackup) GetAttributeById

func (s *MgoAttributeBackup) GetAttributeById(ctx context.Context, id string, path []string) (interface{}, error)

func (*MgoAttributeBackup) Page

func (s *MgoAttributeBackup) Page(ctx context.Context, filter bson.D, p *Page) (PageResult, error)

func (*MgoAttributeBackup) Save

func (s *MgoAttributeBackup) Save(ctx context.Context, kv []*AttributeKV) (*Result, error)

func (*MgoAttributeBackup) SaveBatch

func (s *MgoAttributeBackup) SaveBatch(ctx context.Context, batchKv *BatchAttribute) ([]string, error)

func (*MgoAttributeBackup) UpdateBatch

func (s *MgoAttributeBackup) UpdateBatch(ctx context.Context, id string, dto *AttributeDto) (int64, error)

func (*MgoAttributeBackup) UseCollection

func (s *MgoAttributeBackup) UseCollection(c string)

type Page

type Page struct {
	PageNo   int64    //页数
	PageSize int64    // 一页多少条
	S        []Sort   // 排序规则
	Field    []string // 返回字段
}

type PageResult

type PageResult struct {
	Total int64                    //总页数
	Data  []map[string]interface{} //结果数组
}

type Result

type Result struct {
	Id        string
	RowAffect int64
}

type Service

type Service interface {
	Save(ctx context.Context, kv []*AttributeKV) (string, error)
	UpdateOneByBizId(ctx context.Context, id string, m *AttributeDto) (int64, error)
	SaveBatch(ctx context.Context, batchKv *BatchAttribute) ([]string, error)
	UpdateBatch(ctx context.Context, id string, dto *AttributeDto) (int64, error)
	DeleteAllByBizId(ctx context.Context, id string) (int64, error)
	DeleteAttributeByBizId(ctx context.Context, id string, delKeys []string) (int64, error)
	GetAttributeByBizId(ctx context.Context, id string, path []string) (interface{}, error)
}

type Sort

type Sort struct {
	Key  string // 排序的 key
	Desc bool   // 是否升序 ,true 是升序 false 是降序
}

type UpdateResult

type UpdateResult struct {
	Id        []string
	RowAffect int64
}

Jump to

Keyboard shortcuts

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