Documentation ¶
Index ¶
- Constants
- func HasErrorCode(err error, code int) bool
- type Collection
- func (c Collection) DistinctString(ctx context.Context, fieldName string, filter interface{}, ...) ([]string, error)
- func (c Collection) FindAll(ctx context.Context, filter, results interface{}, opts ...*options.FindOptions) (err error)
- func (c Collection) SetupIndexes(models []mongo.IndexModel) (err error)
- type Database
- func (d Database) Collection(name string, opts ...*options.CollectionOptions) *Collection
- func (db *Database) DoTx(ctx context.Context, fn func(ctx mongo.SessionContext) error) error
- func (db *Database) DoTxWithOptions(ctx context.Context, opts *options.SessionOptions, ...) error
- func (d Database) SetupSchemas(ctx context.Context, fs fs.FS, collectionNames []string) error
Constants ¶
View Source
const (
ErrorCodeDuplicateKey = 11000
)
Variables ¶
This section is empty.
Functions ¶
func HasErrorCode ¶
Types ¶
type Collection ¶
type Collection struct {
*mongo.Collection
}
func (Collection) DistinctString ¶
func (c Collection) DistinctString(ctx context.Context, fieldName string, filter interface{}, opts ...*options.DistinctOptions) ([]string, error)
func (Collection) FindAll ¶
func (c Collection) FindAll(ctx context.Context, filter, results interface{}, opts ...*options.FindOptions) (err error)
func (Collection) SetupIndexes ¶
func (c Collection) SetupIndexes(models []mongo.IndexModel) (err error)
type Database ¶
func (Database) Collection ¶
func (d Database) Collection(name string, opts ...*options.CollectionOptions) *Collection
func (*Database) DoTxWithOptions ¶
func (db *Database) DoTxWithOptions(ctx context.Context, opts *options.SessionOptions, fn func(ctx mongo.SessionContext) error) error
Click to show internal directories.
Click to hide internal directories.