mongo

package
v0.0.0-...-ab943b8 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoFoundError string = "mongo: no documents in result"
)

Variables

This section is empty.

Functions

func Set

func Set(name string, client *Client)

注册

Types

type Client

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

func Get

func Get(name string) *Client

获取

func NewClient

func NewClient(uri string, db string) *Client

func (*Client) Connect

func (o *Client) Connect(uri string, db string) error

func (*Client) DeleteOne

func (o *Client) DeleteOne(collection string, filter Filter) error

删除数据

func (*Client) FindOne

func (o *Client) FindOne(collection string, filter Filter, result interface{}) error

查找数据

func (*Client) InsertOne

func (o *Client) InsertOne(collection string, document interface{}) error

插入数据

func (*Client) Ping

func (o *Client) Ping() error

检查连接是否存在

func (*Client) UpdateOne

func (o *Client) UpdateOne(collection string, filter Filter, document interface{}) error

更新数据

func (*Client) UpsertOne

func (o *Client) UpsertOne(collection string, filter Filter, document interface{}) error

更新数据,如果没有则插入数据

type Filter

type Filter bson.M

查询参数

Jump to

Keyboard shortcuts

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