mongodb

package
v0.0.0-...-ee7ea3e Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataCount

type DataCount struct {
	Count int64 `json:"count"`
}

type DataPaginate

type DataPaginate struct {
	Page       int64    `json:"page"`
	TotalPages int64    `json:"total_pages"`
	Data       []bson.M `json:"data"`
}

type MongoDB

type MongoDB struct {
	Database *mongo.Database
}

func New

func New(database *mongo.Database) *MongoDB

func (*MongoDB) Count

func (m *MongoDB) Count(collectionName string, body []byte) (DataCount, error)

func (*MongoDB) Delete

func (m *MongoDB) Delete(collectionName string, params map[string]string) error

func (*MongoDB) Insert

func (m *MongoDB) Insert(collectionName string, body []byte) (bson.M, error)

func (*MongoDB) List

func (m *MongoDB) List(collectionName string, params map[string]string) ([]bson.M, error)

func (*MongoDB) Paginate

func (m *MongoDB) Paginate(collectionName string, body []byte) (DataPaginate, error)

func (*MongoDB) Query

func (m *MongoDB) Query(collectionName string, body []byte) ([]bson.M, error)

func (*MongoDB) Replace

func (m *MongoDB) Replace(collectionName string, params map[string]string, body []byte) ([]bson.M, error)

func (*MongoDB) Show

func (m *MongoDB) Show(collectionName string, id string) (bson.M, error)

func (*MongoDB) Update

func (m *MongoDB) Update(collectionName string, params map[string]string, body []byte) ([]bson.M, error)

Jump to

Keyboard shortcuts

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