mango

package module
v0.0.0-...-c1715a6 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2020 License: MIT Imports: 15 Imported by: 0

README

mango

Mongo ODM for Golang

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	mongooptions.ClientOptions
	Database string
	Context  context.Context
}

type Connection

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

func Connect

func Connect(config *Config) (*Connection, error)

func (*Connection) Aggregate

func (c *Connection) Aggregate(pipeline aggregation.Stages, value interface{}, opts ...*options.Aggregate) error

func (*Connection) Collection

func (c *Connection) Collection(i interface{}) *Connection

func (*Connection) Context

func (c *Connection) Context(ctx context.Context) *Connection

func (*Connection) DeleteMany

func (c *Connection) DeleteMany(filter interface{}, opts ...*options.Delete) error

func (*Connection) DeleteOne

func (c *Connection) DeleteOne(filter interface{}, opts ...*options.Delete) error

func (*Connection) Disconnect

func (c *Connection) Disconnect() error

func (*Connection) Find

func (c *Connection) Find(filter interface{}, value interface{}, opts ...*options.Find) error

func (*Connection) FindOne

func (c *Connection) FindOne(filter interface{}, value interface{}, opts ...*options.Find) error

func (*Connection) FindWithCursor

func (c *Connection) FindWithCursor(filter interface{}, value interface{}, opts ...*options.Find) (*mongo.Cursor, error)

func (*Connection) GetClient

func (c *Connection) GetClient() *mongo.Client

func (*Connection) InsertMany

func (c *Connection) InsertMany(values interface{}, opts ...*options.Insert) error

func (*Connection) InsertOne

func (c *Connection) InsertOne(value interface{}, opts ...*options.Insert) error

func (*Connection) Model

func (c *Connection) Model(value interface{}) *Connection

func (*Connection) UpdateOne

func (c *Connection) UpdateOne(filter interface{}, update interface{}, opts ...*options.Update) error

type Document

type Document struct {
	ID        primitive.ObjectID `bson:"_id" json:"id"`
	CreatedAt time.Time          `bson:"createdAt" json:"createdAt,omitempty"`
	UpdatedAt time.Time          `bson:"updatedAt" json:"updatedAt,omitempty"`
	DeletedAt *time.Time         `bson:"deletedAt" json:"deletedAt,omitempty"`
}

type Operator

type Operator struct {
	Operator string
	Value    interface{}
}

func Set

func Set(model interface{}) *Operator

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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