bsoner

package
v0.0.0-...-86833b7 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByID

func ByID(id interface{}) bson.D

ByID query by object _id

func NewList

func NewList(list ...interface{}) []interface{}

Types

type Document

type Document struct {
	Doc primitive.D
}

func DocSet

func DocSet(k string, v interface{}) *Document

func NewDocumentBuilder

func NewDocumentBuilder() *Document

func NewDocumentSet

func NewDocumentSet(k string, v interface{}) *Document

func SetOnInsert

func SetOnInsert(k string, v interface{}) *Document

SetOnInsert is equivalent to !expr0 || !expr1 || !expr...

func (*Document) DocSet

func (doc *Document) DocSet(k string, v interface{}) *Document

func (*Document) MarshalBSON

func (doc *Document) MarshalBSON() ([]byte, error)

func (*Document) Set

func (doc *Document) Set(k string, v interface{}) *Document

Set sets bson field k with the value v row[k]=v

func (*Document) SetOnInsert

func (doc *Document) SetOnInsert(k string, v interface{}) *Document

type Filter

type Filter struct {
	Doc primitive.D
}

func And

func And(docs ...interface{}) *Filter

And is equivalent to expr0 && expr1 && expr...

func Eq

func Eq(k string, v interface{}) *Filter

Eq creates a new query object and sets bson field k with row[k][$eq]=v which can be express like row[k] == v

func Exists

func Exists(k string, v interface{}) *Filter

Exists is equivalent to !expr0 || !expr1 || !expr...

func FilterBy

func FilterBy(k string, v interface{}) *Filter

func Gt

func Gt(k string, v interface{}) *Filter

Gt creates a new query object and sets bson field k with row[k][$eq]=v which can be express like row[k] == v

func Gte

func Gte(k string, v interface{}) *Filter

Gte creates a new query object and sets bson field k with row[k][$eq]=v which can be express like row[k] == v

func In

func In(k string, v ...interface{}) *Filter

In creates a new query object and sets bson field k with row[k][$ne]=v which can be express like row[k] != v

func Lt

func Lt(k string, v interface{}) *Filter

Lt creates a new query object and sets bson field k with row[k][$eq]=v which can be express like row[k] == v

func Lte

func Lte(k string, v interface{}) *Filter

Lte creates a new query object and sets bson field k with row[k][$eq]=v which can be express like row[k] == v

func Neq

func Neq(k string, v interface{}) *Filter

Neq creates a new query object and sets bson field k with row[k][$ne]=v which can be express like row[k] != v

func NewFilterBuilder

func NewFilterBuilder() *Filter

func Nin

func Nin(k string, v ...interface{}) *Filter

Nin creates a new query object and sets bson field k with row[k][$ne]=v which can be express like row[k] != v

func NotOr

func NotOr(docs ...interface{}) *Filter

NotOr is equivalent to !expr0 || !expr1 || !expr...

func Or

func Or(docs ...interface{}) *Filter

Or is equivalent to expr0 || expr1 || expr...

func RegEx

func RegEx(k, pattern, options string) *Filter

RegEx creates a new query object and sets bson field k with regex pattern and options

func (*Filter) And

func (filter *Filter) And(docs ...interface{}) *Filter

And is equivalent to expr0 && expr1 && expr...

func (*Filter) Eq

func (filter *Filter) Eq(k string, v interface{}) *Filter

Eq sets bson field k with row[k][$eq]=v which can be express like row[k] == v

func (*Filter) Exists

func (filter *Filter) Exists(k string, v interface{}) *Filter

Exists mongo $exists query

func (*Filter) Gt

func (filter *Filter) Gt(k string, v interface{}) *Filter

Gt sets bson field k with row[k][$gt]=v which can be express like row[k] == v

func (*Filter) Gte

func (filter *Filter) Gte(k string, v interface{}) *Filter

Gte sets bson field k with row[k][$gte]=v which can be express like row[k] == v

func (*Filter) In

func (filter *Filter) In(k string, v ...interface{}) *Filter

In sets bson field k with row[k][$ne]=v which can be express like row[k] != v

func (*Filter) Lt

func (filter *Filter) Lt(k string, v interface{}) *Filter

Lt sets bson field k with row[k][$lt]=v which can be express like row[k] == v

func (*Filter) Lte

func (filter *Filter) Lte(k string, v interface{}) *Filter

Lte sets bson field k with row[k][$lte]=v which can be express like row[k] == v

func (*Filter) MarshalBSON

func (filter *Filter) MarshalBSON() ([]byte, error)

func (*Filter) Neq

func (filter *Filter) Neq(k string, v interface{}) *Filter

Neq sets bson field k with row[k][$ne]=v which can be express like row[k] != v

func (*Filter) Nin

func (filter *Filter) Nin(k string, v ...interface{}) *Filter

Nin sets bson field k with row[k][$ne]=v which can be express like row[k] != v

func (*Filter) NotOr

func (filter *Filter) NotOr(docs ...interface{}) *Filter

NotOr is equivalent to !expr0 || !expr1 || !expr...

func (*Filter) Or

func (filter *Filter) Or(docs ...interface{}) *Filter

Or is equivalent to expr0 || expr1 || expr...

func (*Filter) RegEx

func (filter *Filter) RegEx(k, pattern, options string) *Filter

RegEx sets bson field k with a regex pattern and options

func (*Filter) Set

func (filter *Filter) Set(k string, v interface{}) *Filter

Set sets bson field k with the value v row[k]=v

Jump to

Keyboard shortcuts

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