mongoExport

package module
v0.0.0-...-3dec541 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package mongoExport 导出mongo里的数据到 xlsx, csv, 或者json文件

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(uri, dbName, cltName, userName, password string) (*Client, error)

NewClient uri default 127.0.0.1:27017

func (*Client) ToCsv

func (c *Client) ToCsv(queryBsonM bson.M, limit int64, fileName string, headerS, fieldExclude []string) error

ToCsv To export data from a collection for a CSV file.

headerS 指定 Excel 的字段以及顺序, queryBsonM 过滤条件,可以为nil,代表全部

fieldExclude 排除掉的字段. 当headerS不为空的时候, 该参数失效.

func (*Client) ToExcel

func (c *Client) ToExcel(queryBsonM bson.M, limit int64, fileName string, headerS, fieldExclude []string) error

ToExcel To export data from a collection for a Excel file.

headerS 指定 Excel 的字段以及顺序, queryBsonM 过滤条件,可以为nil,代表全部

fieldExclude 排除掉的字段. 当headerS不为空的时候, 该参数失效.

func (*Client) ToJson

func (c *Client) ToJson(queryBsonM bson.M, limit int64, fileName string, headerS, fieldExclude []string) error

ToJson To export data from a collection for a JSON file.

headerS 指定 Excel 的字段以及顺序, queryBsonM 过滤条件,可以为nil,代表全部

fieldExclude 排除掉的字段. 当headerS不为空的时候, 该参数失效.

Jump to

Keyboard shortcuts

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