database

package
v0.0.0-...-41edef4 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

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

数据库 https://docs.cloudbase.net/api-reference/openapi/database.html

func NewDatabase

func NewDatabase(context *context.Context, core *component.Core) *Database

创建实例

func (*Database) CommitTransaction

func (d *Database) CommitTransaction(table string, transactionId string) (body string, err error)

提交事务 https://docs.cloudbase.net/api-reference/openapi/database.html#transaction

func (*Database) Count

func (d *Database) Count(table string, query *query.Query, transactionId ...string) (body string, err error)

统计查询文档总数 https://docs.cloudbase.net/api-reference/openapi/database.html#count

func (*Database) DeleteDocument

func (d *Database) DeleteDocument(table, docId string, transactionId ...string) (body string, err error)

单文档删除 https://docs.cloudbase.net/api-reference/openapi/database.html#deletedocument

func (*Database) DeleteMany

func (d *Database) DeleteMany(table string, query *query.Query, transactionId ...string) (body string, err error)

批量查询并批量删除 https://docs.cloudbase.net/api-reference/openapi/database.html#deletemany

func (*Database) DeleteOne

func (d *Database) DeleteOne(table string, query *query.Query, transactionId ...string) (body string, err error)

批量查询并删除单文档 https://docs.cloudbase.net/api-reference/openapi/database.html#deleteone

func (*Database) Find

func (d *Database) Find(table string, query *query.Query, limit, skip uint64, fields bson.M, sort bson.M, transactionId ...string) (body string, err error)

批量查询文档 https://docs.cloudbase.net/api-reference/openapi/database.html#find

func (*Database) GetDocument

func (d *Database) GetDocument(table, docId string, limit, skip uint64, fields bson.M, sort bson.M, transactionId ...string) (body string, err error)

单文档查询 https://docs.cloudbase.net/api-reference/openapi/database.html#getdocument

func (*Database) HttpDeleteJson

func (d *Database) HttpDeleteJson(path string, request interface{}, headers ...map[string]string) (body string, err error)

可直接使用Delete请求

func (*Database) HttpGetJson

func (d *Database) HttpGetJson(path string, params url.Values, headers ...map[string]string) (body string, err error)

可直接使用Get请求

func (*Database) HttpPatchJson

func (d *Database) HttpPatchJson(path string, request interface{}, headers ...map[string]string) (body string, err error)

可直接使用Patch请求

func (*Database) HttpPostJson

func (d *Database) HttpPostJson(path string, request interface{}, headers ...map[string]string) (body string, err error)

可直接使用Post请求

func (*Database) InsertDocument

func (d *Database) InsertDocument(table, docId string, data bson.M, transactionId ...string) (body string, err error)

单文档插入 https://docs.cloudbase.net/api-reference/openapi/database.html#insertdocument

func (*Database) InsertDocuments

func (d *Database) InsertDocuments(table string, data []bson.M, transactionId ...string) (body string, err error)

批量插入文档 https://docs.cloudbase.net/api-reference/openapi/database.html#insertdocuments

func (*Database) RollbackTransaction

func (d *Database) RollbackTransaction(table string, transactionId string) (body string, err error)

提交事务 https://docs.cloudbase.net/api-reference/openapi/database.html#transaction

func (*Database) SetDocument

func (d *Database) SetDocument(table, docId string, data bson.M, transactionId ...string) (body string, err error)

单文档替换更新 https://docs.cloudbase.net/api-reference/openapi/database.html#setdocument

func (*Database) Transaction

func (d *Database) Transaction(table string) (body string, err error)

开始事务 https://docs.cloudbase.net/api-reference/openapi/database.html#transaction

func (*Database) UpdateDocument

func (d *Database) UpdateDocument(table, docId string, data bson.M, transactionId ...string) (body string, err error)

单文档更新 https://docs.cloudbase.net/api-reference/openapi/database.html#updatedocument

func (*Database) UpdateMany

func (d *Database) UpdateMany(table string, query *query.Query, data bson.M, transactionId ...string) (body string, err error)

批量查询并批量更新 https://docs.cloudbase.net/api-reference/openapi/database.html#updatemany

func (*Database) UpdateOne

func (d *Database) UpdateOne(table string, query *query.Query, data bson.M, transactionId ...string) (body string, err error)

批量查询并更新单文档 https://docs.cloudbase.net/api-reference/openapi/database.html#updateone

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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