dao

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ResourceCollection = "c_resources"

Variables

This section is empty.

Functions

func InitIndexes

func InitIndexes(db *mongox.Mongo) error

Types

type Pipeline

type Pipeline struct {
	ModelUid string `bson:"_id"`
	Total    int    `bson:"total"`
}

type Resource

type Resource struct {
	ID       int64         `bson:"id"`
	ModelUID string        `bson:"model_uid"`
	Data     mongox.MapStr `bson:",inline"`
	Ctime    int64         `bson:"ctime"`
	Utime    int64         `bson:"utime"`
}

type ResourceDAO

type ResourceDAO interface {
	CreateResource(ctx context.Context, resource Resource) (int64, error)
	FindResourceById(ctx context.Context, fields []string, id int64) (Resource, error)
	ListResource(ctx context.Context, fields []string, modelUid string, offset, limit int64) ([]Resource, error)
	Count(ctx context.Context, modelUid string) (int64, error)
	ListResourcesByIds(ctx context.Context, fields []string, ids []int64) ([]Resource, error)
	DeleteResource(ctx context.Context, id int64) (int64, error)
	ListExcludeAndFilterResourceByIds(ctx context.Context, fields []string, modelUid string, offset, limit int64,
		ids []int64, filter domain.Condition) ([]Resource, error)
	TotalExcludeAndFilterResourceByIds(ctx context.Context, modelUid string, ids []int64,
		filter domain.Condition) (int64, error)
	PipelineByModelUid(ctx context.Context) ([]Pipeline, error)
	Search(ctx context.Context, text string) ([]SearchResource, error)

	FindSecureData(ctx context.Context, id int64, fieldUid string) (string, error)
}

func NewResourceDAO

func NewResourceDAO(db *mongox.Mongo) ResourceDAO

type SearchResource

type SearchResource struct {
	ModelUid string          `bson:"_id"`
	Total    int             `bson:"total"`
	Data     []mongox.MapStr `bson:"data"`
}

Jump to

Keyboard shortcuts

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