document

package
v0.0.0-...-2dc6276 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	GetDB(string) (DB, error) // get collection by name
}

func NewClient

func NewClient(uri string) (Client, error)

now just use mongo

type Coll

type Coll interface {
	Query(filter interface{}, records interface{}, sortMap ...map[string]interface{}) error // query by filter
	Query2chan(filter interface{}, recordChan chan map[string]interface{}, sortMap ...map[string]interface{}) error
	Insert(records []interface{}) ([]string, error) // insert
	DeleteByID(id string) error
	UpdateByID(id string, update map[string]interface{}) error
	CreateIndexes(nameCols ...string) error
}

type DB

type DB interface {
	GetColl(string) (Coll, error)
	RemoveCollById(string) error
	NewColl(id string) error
}

func GetDB

func GetDB(uri string) (DB, error)

type MongoClient

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

func NewMongoClient

func NewMongoClient(uri string) (*MongoClient, error)

func (*MongoClient) GetDB

func (s *MongoClient) GetDB(name string) (DB, error)

type MongoColl

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

func (*MongoColl) CreateIndexes

func (s *MongoColl) CreateIndexes(nameCols ...string) error

func (*MongoColl) DeleteByID

func (s *MongoColl) DeleteByID(id string) error

deletebyid

func (*MongoColl) Insert

func (s *MongoColl) Insert(records []interface{}) ([]string, error)

func (*MongoColl) Query

func (s *MongoColl) Query(filter interface{}, results interface{}, sortMap ...map[string]interface{}) error

func (*MongoColl) Query2chan

func (s *MongoColl) Query2chan(filter interface{}, records chan map[string]interface{}, sortMap ...map[string]interface{}) error

func (*MongoColl) UpdateByID

func (s *MongoColl) UpdateByID(id string, update map[string]interface{}) error

updatebyid

type MongoDB

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

func (*MongoDB) GetColl

func (s *MongoDB) GetColl(name string) (Coll, error)

func (*MongoDB) NewColl

func (s *MongoDB) NewColl(id string) error

func (*MongoDB) RemoveCollById

func (s *MongoDB) RemoveCollById(id string) error

Jump to

Keyboard shortcuts

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