Documentation
¶
Index ¶
- Constants
- func FieldTagName(field reflect.StructField) string
- func WithAuth(username, password string) func(opts *Options)
- type Client
- type Collection
- func (p *Collection) DeleteOne(filter any) (bool, error)
- func (p *Collection) Find(filter any, results any, fields ...string) error
- func (p *Collection) FindOne(id string, out any, fields ...string) error
- func (p *Collection) Insert(document any) (string, error)
- func (p *Collection) InsertMany(documents ...any) ([]string, error)
- func (p *Collection) RawFind(filter bson.M, results any, opts *options.FindOptions) error
- func (p *Collection) Update(id string, document any) error
- func (p *Collection) UpdateInsert(filter, update any) (string, error)
- func (p *Collection) UpdateMany(filter, update bson.M) error
- type Options
Constants ¶
View Source
const DefaultURI = "mongodb://127.0.0.1:27017"
Variables ¶
This section is empty.
Functions ¶
func FieldTagName ¶
func FieldTagName(field reflect.StructField) string
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Collection ¶
func (p *Client) Collection(name string) *Collection
type Collection ¶
type Collection struct {
// contains filtered or unexported fields
}
func (*Collection) Find ¶
func (p *Collection) Find(filter any, results any, fields ...string) error
Find finds documents by filter and returns the results. The results must be a pointer to a slice.
func (*Collection) FindOne ¶
func (p *Collection) FindOne(id string, out any, fields ...string) error
func (*Collection) InsertMany ¶
func (p *Collection) InsertMany(documents ...any) ([]string, error)
func (*Collection) RawFind ¶
func (p *Collection) RawFind(filter bson.M, results any, opts *options.FindOptions) error
func (*Collection) UpdateInsert ¶
func (p *Collection) UpdateInsert(filter, update any) (string, error)
func (*Collection) UpdateMany ¶
func (p *Collection) UpdateMany(filter, update bson.M) error
Click to show internal directories.
Click to hide internal directories.