storage

package
v0.0.0-...-3e530b2 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mgo

type Mgo struct {
	Uri        string //数据库网络地址
	Database   string //要连接的数据库
	Collection string //要连接的集合
}

func (*Mgo) Connect

func (m *Mgo) Connect() (*mongo.Collection, error)

type MongoTemplate

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

func NewMongoTemplate

func NewMongoTemplate(mgo *Mgo) *MongoTemplate

func (*MongoTemplate) Delete

func (t *MongoTemplate) Delete(filter bson.D) (interface{}, error)

*

  • 删除数据

func (*MongoTemplate) Expire

func (t *MongoTemplate) Expire() (interface{}, error)

设置索引的过期时间

func (*MongoTemplate) GetCollection

func (t *MongoTemplate) GetCollection() *mongo.Collection

func (*MongoTemplate) Insert

func (t *MongoTemplate) Insert(document interface{}) (interface{}, error)

*

  • 插入数据

func (*MongoTemplate) Query

func (t *MongoTemplate) Query(filter bson.D) *mongo.SingleResult

*

  • 查询单条数据

func (*MongoTemplate) Update

func (t *MongoTemplate) Update(filter bson.D, update bson.D) (interface{}, error)

*

  • 更新数据

Jump to

Keyboard shortcuts

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