module

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const DemoCollectionName = "demo"

DemoCollectionName 在mongo表名,约定首字母小写

Variables

This section is empty.

Functions

func CountDemos

func CountDemos(selector bson.M) (n int, err error)

CountDemos 统计数量,不包括删除记录

func DeleteDemo

func DeleteDemo(selector bson.M) (int, error)

DeleteDemo 删除记录

func UpdateDemo

func UpdateDemo(selector, update bson.M) (err error)

UpdateDemo 更新单条记录

func UpdateDemos

func UpdateDemos(selector, update bson.M) (n int, err error)

UpdateDemos 更新多条记录

Types

type Demo

type Demo struct {
	mongo.PublicFields `bson:",inline"`

	UserID     string      `bson:"userID" json:"userID"`         // 用户id
	FileID     string      `bson:"fileID" json:"fileID"`         // 文件id
	TaskID     string      `bson:"taskID" json:"taskID"`         // 策略运行id,需要建立索引
	PolicyName string      `bson:"policyName" json:"policyName"` // 用户命名的策略名称
	Message    interface{} `bson:"message" json:"message"`       // 信息内容
}

Demo 用户消息

func FindAndModifyDemo

func FindAndModifyDemo(selector bson.M, update bson.M) (*Demo, error)

FindAndModifyDemo 更新并返回最新记录

func FindDemo

func FindDemo(selector bson.M, field bson.M) (*Demo, error)

FindDemo 获取单条记录

func FindDemos

func FindDemos(selector bson.M, field bson.M, page int, limit int, sort ...string) ([]*Demo, error)

FindDemos 获取多条记录

func (*Demo) Insert

func (object *Demo) Insert() (err error)

Insert 插入一条新的记录

Jump to

Keyboard shortcuts

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