 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
- Variables
- type BatchDeleteFileReq
- type BatchDeleteFileRes
- type BatchDownloadFileReq
- type BatchDownloadFileRes
- type ConflictMode
- type CreateIndex
- type CreateIndexKey
- type DatabaseAddRes
- type DatabaseCollectionGetReq
- type DatabaseCollectionGetRes
- type DatabaseCollectionReq
- type DatabaseCountRes
- type DatabaseDeleteRes
- type DatabaseMigrateExportReq
- type DatabaseMigrateExportRes
- type DatabaseMigrateImportReq
- type DatabaseMigrateImportRes
- type DatabaseMigrateQueryInfoRes
- type DatabaseQueryRes
- type DatabaseReq
- type DatabaseUpdateRes
- type DownloadFile
- type DropIndex
- type FileType
- type InvokeCloudFunctionRes
- type Tcb
- func (tcb *Tcb) BatchDeleteFile(env string, fileIDList []string) (*BatchDeleteFileRes, error)
- func (tcb *Tcb) BatchDownloadFile(env string, fileList []*DownloadFile) (*BatchDownloadFileRes, error)
- func (tcb *Tcb) DatabaseAdd(env, query string) (*DatabaseAddRes, error)
- func (tcb *Tcb) DatabaseCollectionAdd(env, collectionName string) error
- func (tcb *Tcb) DatabaseCollectionDelete(env, collectionName string) error
- func (tcb *Tcb) DatabaseCollectionGet(env string, limit, offset int64) (*DatabaseCollectionGetRes, error)
- func (tcb *Tcb) DatabaseCount(env, query string) (*DatabaseCountRes, error)
- func (tcb *Tcb) DatabaseDelete(env, query string) (*DatabaseDeleteRes, error)
- func (tcb *Tcb) DatabaseMigrateExport(req *DatabaseMigrateExportReq) (*DatabaseMigrateExportRes, error)
- func (tcb *Tcb) DatabaseMigrateImport(req *DatabaseMigrateImportReq) (*DatabaseMigrateImportRes, error)
- func (tcb *Tcb) DatabaseMigrateQueryInfo(env string, jobID int64) (*DatabaseMigrateQueryInfoRes, error)
- func (tcb *Tcb) DatabaseQuery(env, query string) (*DatabaseQueryRes, error)
- func (tcb *Tcb) DatabaseUpdate(env, query string) (*DatabaseUpdateRes, error)
- func (tcb *Tcb) InvokeCloudFunction(env, name, args string) (*InvokeCloudFunctionRes, error)
- func (tcb *Tcb) UpdateIndex(req *UpdateIndexReq) error
- func (tcb *Tcb) UploadFile(env, path string) (*UploadFileRes, error)
 
- type UpdateIndexReq
- type UploadFileReq
- type UploadFileRes
Constants ¶
const ( // ConflictModeInster 冲突处理模式 插入 ConflictModeInster ConflictMode = 1 // ConflictModeUpsert 冲突处理模式 更新 ConflictModeUpsert ConflictMode = 2 // FileTypeJSON 的合法值 json FileTypeJSON FileType = 1 // FileTypeCsv 的合法值 csv FileTypeCsv FileType = 2 )
Variables ¶
var ValidDirections = []string{"1", "-1", "2dsphere"}
    ValidDirections 合法的direction值
Functions ¶
This section is empty.
Types ¶
type BatchDeleteFileReq ¶
type BatchDeleteFileReq struct {
	Env        string   `json:"env,omitempty"`
	FileIDList []string `json:"fileid_list,omitempty"`
}
    BatchDeleteFileReq 批量删除文件请求参数
type BatchDeleteFileRes ¶
type BatchDeleteFileRes struct {
	util.CommonError
	DeleteList []struct {
		FileID string `json:"fileid"`
		Status int64  `json:"status"`
		ErrMsg string `json:"errmsg"`
	} `json:"delete_list"`
}
    BatchDeleteFileRes 批量删除文件返回结果
type BatchDownloadFileReq ¶
type BatchDownloadFileReq struct {
	Env      string          `json:"env,omitempty"`
	FileList []*DownloadFile `json:"file_list,omitempty"`
}
    BatchDownloadFileReq 上传文件请求值
type BatchDownloadFileRes ¶
type BatchDownloadFileRes struct {
	util.CommonError
	FileList []struct {
		FileID      string `json:"file_id"`      // 文件ID
		DownloadURL string `json:"download_url"` // 下载链接
		Status      int64  `json:"status"`       // 状态码
		ErrMsg      string `json:"errmsg"`       // 该文件错误信息
	} `json:"file_list"`
}
    BatchDownloadFileRes 上传文件返回结果
type CreateIndex ¶
type CreateIndex struct {
	Name   string           `json:"name,omitempty"`   // 索引名
	Unique bool             `json:"unique,omitempty"` // 是否唯一
	Keys   []CreateIndexKey `json:"keys,omitempty"`   // 索引字段
}
    CreateIndex 新增索引
type CreateIndexKey ¶
type CreateIndexKey struct {
	Name      string `json:"name,omitempty"`      // 字段名
	Direction string `json:"direction,omitempty"` // 字段排序
}
    CreateIndexKey create index key
type DatabaseAddRes ¶
type DatabaseAddRes struct {
	util.CommonError
	IDList []string `json:"id_list"` // 插入成功的数据集合主键_id。
}
    DatabaseAddRes 数据库插入记录返回结果
type DatabaseCollectionGetReq ¶
type DatabaseCollectionGetReq struct {
	Env    string `json:"env,omitempty"`    // 云环境ID
	Limit  int64  `json:"limit,omitempty"`  // 获取数量限制
	Offset int64  `json:"offset,omitempty"` // 偏移量
}
    DatabaseCollectionGetReq 获取特定云环境下集合信息请求
type DatabaseCollectionGetRes ¶
type DatabaseCollectionGetRes struct {
	util.CommonError
	Pager struct {
		Limit  int64 `json:"limit"`  // 单次查询限制
		Offset int64 `json:"offset"` // 偏移量
		Total  int64 `json:"total"`  // 符合查询条件的记录总数
	} `json:"pager"`
	Collections []struct {
		Name       string `json:"name"`        // 集合名
		Count      int64  `json:"count"`       // 表中文档数量
		Size       int64  `json:"size"`        // 表的大小(即表中文档总大小),单位:字节
		IndexCount int64  `json:"index_count"` // 索引数量
		IndexSize  int64  `json:"index_size"`  // 索引占用大小,单位:字节
	} `json:"collections"`
}
    DatabaseCollectionGetRes 获取特定云环境下集合信息结果
type DatabaseCollectionReq ¶
type DatabaseCollectionReq struct {
	Env            string `json:"env,omitempty"`             // 云环境ID
	CollectionName string `json:"collection_name,omitempty"` // 集合名称
}
    DatabaseCollectionReq 新增/删除集合请求参数
type DatabaseCountRes ¶
type DatabaseCountRes struct {
	util.CommonError
	Count int64 `json:"count"` // 记录数量
}
    DatabaseCountRes 统计集合记录数或统计查询语句对应的结果记录数 返回结果
type DatabaseDeleteRes ¶
type DatabaseDeleteRes struct {
	util.CommonError
	Deleted int64 `json:"deleted"` // 删除记录数量
}
    DatabaseDeleteRes 数据库删除记录返回结果
type DatabaseMigrateExportReq ¶
type DatabaseMigrateExportReq struct {
	Env      string   `json:"env,omitempty"`       // 云环境ID
	FilePath string   `json:"file_path,omitempty"` // 导出文件路径(导入文件需先上传到同环境的存储中,可使用开发者工具或 HTTP API的上传文件 API上传)
	FileType FileType `json:"file_type,omitempty"` // 导出文件类型,文件格式参考数据库导入指引中的文件格式部分  1:json 2:csv
	Query    string   `json:"query,omitempty"`     // 导出条件
}
    DatabaseMigrateExportReq 数据库出 请求参数
type DatabaseMigrateExportRes ¶
type DatabaseMigrateExportRes struct {
	util.CommonError
	JobID int64 `json:"job_id"` // 导出任务ID,可使用数据库迁移进度查询 API 查询导入进度及结果
}
    DatabaseMigrateExportRes 数据库导出 返回结果
type DatabaseMigrateImportReq ¶
type DatabaseMigrateImportReq struct {
	Env            string       `json:"env,omitempty"`             // 云环境ID
	CollectionName string       `json:"collection_name,omitempty"` // 集合名称
	FilePath       string       `json:"file_path,omitempty"`       // 导出文件路径(文件会导出到同环境的云存储中,可使用获取下载链接 API 获取下载链接)
	FileType       FileType     `json:"file_type,omitempty"`       // 导入文件类型,文件格式参考数据库导入指引中的文件格式部分  1:json 2:csv
	StopOnError    bool         `json:"stop_on_error,omitempty"`   // 是否在遇到错误时停止导入
	ConflictMode   ConflictMode `json:"conflict_mode,omitempty"`   // 冲突处理模式  1:inster 2:UPSERT
}
    DatabaseMigrateImportReq 数据库导入 请求参数
type DatabaseMigrateImportRes ¶
type DatabaseMigrateImportRes struct {
	util.CommonError
	JobID int64 `json:"job_id"` // 导入任务ID,可使用数据库迁移进度查询 API 查询导入进度及结果
}
    DatabaseMigrateImportRes 数据库导入 返回结果
type DatabaseMigrateQueryInfoRes ¶
type DatabaseMigrateQueryInfoRes struct {
	util.CommonError
	Status        string `json:"status"`         // 导出状态
	RecordSuccess int64  `json:"record_success"` // 导出成功记录数
	RecordFail    int64  `json:"record_fail"`    // 导出失败记录数
	ErrMsg        string `json:"err_msg"`        // 导出错误信息
	FileURL       string `json:"file_url"`       // 导出文件下载地址
}
    DatabaseMigrateQueryInfoRes 数据库迁移状态查询
type DatabaseQueryRes ¶
type DatabaseQueryRes struct {
	util.CommonError
	Pager struct {
		Limit  int64 `json:"limit"`  // 单次查询限制
		Offset int64 `json:"offset"` // 偏移量
		Total  int64 `json:"total"`  // 符合查询条件的记录总数
	} `json:"pager"`
	Data []string `json:"data"`
}
    DatabaseQueryRes 数据库查询记录 返回结果
type DatabaseReq ¶
type DatabaseReq struct {
	Env   string `json:"env,omitempty"`   // 云环境ID
	Query string `json:"query,omitempty"` // 数据库操作语句
}
    DatabaseReq 数据库插入/删除/更新/查询/统计记录请求参数
type DatabaseUpdateRes ¶
type DatabaseUpdateRes struct {
	util.CommonError
	Matched  int64  `json:"matched"`  // 更新条件匹配到的结果数
	Modified int64  `json:"modified"` // 修改的记录数,注意:使用set操作新插入的数据不计入修改数目
	ID       string `json:"id"`
}
    DatabaseUpdateRes 数据库更新记录返回结果
type DownloadFile ¶
type DownloadFile struct {
	FileID string `json:"fileid"`  // 文件ID
	MaxAge int64  `json:"max_age"` // 下载链接有效期
}
    DownloadFile 文件信息
type InvokeCloudFunctionRes ¶
type InvokeCloudFunctionRes struct {
	util.CommonError
	RespData string `json:"resp_data"` // 云函数返回的buffer
}
    InvokeCloudFunctionRes 云函数调用返回结果
type Tcb ¶
Tcb Tencent Cloud Base
func (*Tcb) BatchDeleteFile ¶
func (tcb *Tcb) BatchDeleteFile(env string, fileIDList []string) (*BatchDeleteFileRes, error)
BatchDeleteFile 批量删除文件
func (*Tcb) BatchDownloadFile ¶
func (tcb *Tcb) BatchDownloadFile(env string, fileList []*DownloadFile) (*BatchDownloadFileRes, error)
BatchDownloadFile 获取文件下载链接
func (*Tcb) DatabaseAdd ¶
func (tcb *Tcb) DatabaseAdd(env, query string) (*DatabaseAddRes, error)
DatabaseAdd 数据库插入记录
func (*Tcb) DatabaseCollectionAdd ¶
DatabaseCollectionAdd 新增集合
func (*Tcb) DatabaseCollectionDelete ¶
DatabaseCollectionDelete 删除集合
func (*Tcb) DatabaseCollectionGet ¶
func (tcb *Tcb) DatabaseCollectionGet(env string, limit, offset int64) (*DatabaseCollectionGetRes, error)
DatabaseCollectionGet 获取特定云环境下集合信息
func (*Tcb) DatabaseCount ¶
func (tcb *Tcb) DatabaseCount(env, query string) (*DatabaseCountRes, error)
DatabaseCount 统计集合记录数或统计查询语句对应的结果记录数
func (*Tcb) DatabaseDelete ¶
func (tcb *Tcb) DatabaseDelete(env, query string) (*DatabaseDeleteRes, error)
DatabaseDelete 数据库插入记录
func (*Tcb) DatabaseMigrateExport ¶
func (tcb *Tcb) DatabaseMigrateExport(req *DatabaseMigrateExportReq) (*DatabaseMigrateExportRes, error)
DatabaseMigrateExport 数据库导出
func (*Tcb) DatabaseMigrateImport ¶
func (tcb *Tcb) DatabaseMigrateImport(req *DatabaseMigrateImportReq) (*DatabaseMigrateImportRes, error)
DatabaseMigrateImport 数据库导入
func (*Tcb) DatabaseMigrateQueryInfo ¶
func (tcb *Tcb) DatabaseMigrateQueryInfo(env string, jobID int64) (*DatabaseMigrateQueryInfoRes, error)
DatabaseMigrateQueryInfo 数据库迁移状态查询
func (*Tcb) DatabaseQuery ¶
func (tcb *Tcb) DatabaseQuery(env, query string) (*DatabaseQueryRes, error)
DatabaseQuery 数据库查询记录
func (*Tcb) DatabaseUpdate ¶
func (tcb *Tcb) DatabaseUpdate(env, query string) (*DatabaseUpdateRes, error)
DatabaseUpdate 数据库插入记录
func (*Tcb) InvokeCloudFunction ¶
func (tcb *Tcb) InvokeCloudFunction(env, name, args string) (*InvokeCloudFunctionRes, error)
InvokeCloudFunction 云函数调用
func (*Tcb) UpdateIndex ¶
func (tcb *Tcb) UpdateIndex(req *UpdateIndexReq) error
UpdateIndex 变更数据库索引 https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-http-api/database/updateIndex.html
func (*Tcb) UploadFile ¶
func (tcb *Tcb) UploadFile(env, path string) (*UploadFileRes, error)
UploadFile 上传文件
type UpdateIndexReq ¶
type UpdateIndexReq struct {
	Env            string        `json:"env,omitempty"`             // 云环境ID
	CollectionName string        `json:"collection_name,omitempty"` // 集合名称
	CreateIndexes  []CreateIndex `json:"create_indexes,omitempty"`  // 新增索引
	DropIndexes    []DropIndex   `json:"drop_indexes,omitempty"`    // 删除索引
}
    UpdateIndexReq 变更数据库索引 请求参数
type UploadFileReq ¶
UploadFileReq 上传文件请求值
type UploadFileRes ¶
type UploadFileRes struct {
	util.CommonError
	URL           string `json:"url"`           // 上传url
	Token         string `json:"token"`         // token
	Authorization string `json:"authorization"` // authorization
	FileID        string `json:"file_id"`       // 文件ID
	CosFileID     string `json:"cos_file_id"`   // cos文件ID
}
    UploadFileRes 上传文件返回结果