teamongo

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2019 License: MIT Imports: 26 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ValueQueryActionCount   = "count"
	ValueQueryActionSum     = "sum"
	ValueQueryActionAvg     = "avg"
	ValueQueryActionMin     = "min"
	ValueQueryActionMax     = "max"
	ValueQueryActionFind    = "find"
	ValueQueryActionFindAll = "findAll"
)
View Source
const (
	QueryActionCount   = "count"
	QueryActionSum     = "sum"
	QueryActionAvg     = "avg"
	QueryActionMin     = "min"
	QueryActionMax     = "max"
	QueryActionFind    = "find"
	QueryActionFindAll = "findAll"
)
View Source
const (
	DatabaseName = "teaweb" // 数据库名
)

Variables

This section is empty.

Functions

func BSONArrayBytes

func BSONArrayBytes(data []byte) (interface{}, error)

func BSONDecode

func BSONDecode(value interface{}) (interface{}, error)

func NewClient added in v0.1.2

func NewClient() *mongo.Client

获取新Client

func RestartClient

func RestartClient()

func SharedClient

func SharedClient() *mongo.Client

获取共享的Client

func Test

func Test() error

测试连接

Types

type AgentValueQuery

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

func NewAgentValueQuery

func NewAgentValueQuery() *AgentValueQuery

func (*AgentValueQuery) Action

func (*AgentValueQuery) Agent

func (this *AgentValueQuery) Agent(agentId string) *AgentValueQuery

func (*AgentValueQuery) App

func (this *AgentValueQuery) App(appId string) *AgentValueQuery

func (*AgentValueQuery) Asc

func (this *AgentValueQuery) Asc(field string) *AgentValueQuery

func (*AgentValueQuery) Attr

func (this *AgentValueQuery) Attr(field string, value interface{}) *AgentValueQuery

func (*AgentValueQuery) Debug

func (this *AgentValueQuery) Debug() *AgentValueQuery

func (*AgentValueQuery) Delete

func (this *AgentValueQuery) Delete() error

删除数据

func (*AgentValueQuery) Desc

func (this *AgentValueQuery) Desc(field string) *AgentValueQuery

func (*AgentValueQuery) Execute

func (this *AgentValueQuery) Execute() (interface{}, error)

开始执行

func (*AgentValueQuery) Find

func (this *AgentValueQuery) Find() (*agents.Value, error)

查找单个数据

func (*AgentValueQuery) FindAll added in v0.1.2

func (this *AgentValueQuery) FindAll() ([]*agents.Value, error)

查找多个数据

func (*AgentValueQuery) For

func (this *AgentValueQuery) For(field string) *AgentValueQuery

func (*AgentValueQuery) Group

func (this *AgentValueQuery) Group(group []string) *AgentValueQuery

func (*AgentValueQuery) Gt

func (this *AgentValueQuery) Gt(field string, value interface{}) *AgentValueQuery

func (*AgentValueQuery) Gte

func (this *AgentValueQuery) Gte(field string, value interface{}) *AgentValueQuery

func (*AgentValueQuery) Id

func (this *AgentValueQuery) Id(idString string) *AgentValueQuery

设置日志ID

func (*AgentValueQuery) Insert

func (this *AgentValueQuery) Insert(value *agents.Value) error

插入新数据

func (*AgentValueQuery) Item

func (this *AgentValueQuery) Item(itemId string) *AgentValueQuery

func (*AgentValueQuery) Limit

func (this *AgentValueQuery) Limit(size int64) *AgentValueQuery

func (*AgentValueQuery) Lt

func (this *AgentValueQuery) Lt(field string, value interface{}) *AgentValueQuery

func (*AgentValueQuery) Lte

func (this *AgentValueQuery) Lte(field string, value interface{}) *AgentValueQuery

func (*AgentValueQuery) Not

func (this *AgentValueQuery) Not(field string, value interface{}) *AgentValueQuery

func (*AgentValueQuery) Offset

func (this *AgentValueQuery) Offset(offset int64) *AgentValueQuery

func (*AgentValueQuery) Op

func (this *AgentValueQuery) Op(op string, field string, value interface{})

type AgentValueQueryAction

type AgentValueQueryAction = string

type Collection

type Collection struct {
	*mongo.Collection
}

func FindCollection

func FindCollection(collName string) *Collection

func (*Collection) CreateIndex

func (this *Collection) CreateIndex(indexes map[string]bool) error

创建索引

type Config

type Config struct {
	URI string `yaml:"uri"`
}

type Query

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

func NewAuditsQuery

func NewAuditsQuery() *Query

审计日志

func NewQuery

func NewQuery(collectionName string, modelPtr interface{}) *Query

func (*Query) Action

func (this *Query) Action(action QueryAction) *Query

func (*Query) Asc

func (this *Query) Asc(field string) *Query

func (*Query) AscPk

func (this *Query) AscPk() *Query

func (*Query) Attr

func (this *Query) Attr(field string, value interface{}) *Query

func (*Query) Coll

func (this *Query) Coll() *Collection

选择集合

func (*Query) Count

func (this *Query) Count() (int64, error)

数字

func (*Query) Debug

func (this *Query) Debug() *Query

func (*Query) Delete

func (this *Query) Delete() error

删除数据

func (*Query) Desc

func (this *Query) Desc(field string) *Query

func (*Query) DescPk

func (this *Query) DescPk() *Query

func (*Query) Execute

func (this *Query) Execute() (interface{}, error)

开始执行

func (*Query) Find

func (this *Query) Find() (interface{}, error)

查找单个数据

func (*Query) FindAll

func (this *Query) FindAll() (result []interface{}, err error)

func (*Query) For

func (this *Query) For(field string) *Query

func (*Query) Group

func (this *Query) Group(group []string) *Query

func (*Query) Gt

func (this *Query) Gt(field string, value interface{}) *Query

func (*Query) Gte

func (this *Query) Gte(field string, value interface{}) *Query

func (*Query) Id

func (this *Query) Id(idString string) *Query

设置日志ID

func (*Query) Insert

func (this *Query) Insert(value interface{}) error

插入新数据

func (*Query) Item

func (this *Query) Item(itemId string) *Query

func (*Query) Limit

func (this *Query) Limit(size int64) *Query

func (*Query) Lt

func (this *Query) Lt(field string, value interface{}) *Query

func (*Query) Lte

func (this *Query) Lte(field string, value interface{}) *Query

func (*Query) Not

func (this *Query) Not(field string, value interface{}) *Query

func (*Query) Offset

func (this *Query) Offset(offset int64) *Query

func (*Query) Op

func (this *Query) Op(op string, field string, value interface{})

func (*Query) Or

func (this *Query) Or(conds ...map[string]interface{}) *Query

func (*Query) Result added in v0.1.2

func (this *Query) Result(field ...string) *Query

func (*Query) Update

func (this *Query) Update(updates maps.Map) error

更新数据

type QueryAction

type QueryAction = string

Jump to

Keyboard shortcuts

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