Documentation
¶
Index ¶
- Variables
- func Asc(field string) bson.D
- func CreateIndexes(ctx context.Context, coll *mongo.Collection, models ...mongo.IndexModel) error
- func Desc(field string) bson.D
- func DropIndexes(ctx context.Context, coll *mongo.Collection, names ...string) error
- func EnsureCollection(ctx context.Context, db *mongo.Database, name string, opts ...CollectionOption) (*mongo.Collection, error)
- func GetMigrations(filters ...MigrationFilter) map[string]Migration
- func MustRegister(ms ...Migration)
- func Register(m Migration) error
- func RegisteredMigrations() map[string]Migration
- func Text(field string) bson.D
- type CollectionOption
- type IndexBuilder
- type Migration
- type MigrationFilter
- type MigrationMetadata
- type MigrationStatus
- type SchemaBuilder
- func (s *SchemaBuilder) Array(items any) bson.M
- func (s *SchemaBuilder) Bool() bson.M
- func (s *SchemaBuilder) BsonType(t string) *SchemaBuilder
- func (s *SchemaBuilder) Build() bson.M
- func (s *SchemaBuilder) Date() bson.M
- func (s *SchemaBuilder) Field(name string, value any) *SchemaBuilder
- func (s *SchemaBuilder) Int() bson.M
- func (s *SchemaBuilder) Long() bson.M
- func (s *SchemaBuilder) Object(props bson.M) bson.M
- func (s *SchemaBuilder) Properties(props bson.M) *SchemaBuilder
- func (s *SchemaBuilder) Required(fields ...string) *SchemaBuilder
- func (s *SchemaBuilder) String() bson.M
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func CreateIndexes ¶
func CreateIndexes(ctx context.Context, coll *mongo.Collection, models ...mongo.IndexModel) error
func DropIndexes ¶
func EnsureCollection ¶
func EnsureCollection( ctx context.Context, db *mongo.Database, name string, opts ...CollectionOption, ) (*mongo.Collection, error)
func GetMigrations ¶
func GetMigrations(filters ...MigrationFilter) map[string]Migration
func MustRegister ¶
func MustRegister(ms ...Migration)
func RegisteredMigrations ¶
Types ¶
type CollectionOption ¶
type CollectionOption func(*options.CreateCollectionOptionsBuilder)
func WithValidationLevel ¶
func WithValidationLevel(level string) CollectionOption
func WithValidator ¶
func WithValidator(schema bson.M) CollectionOption
type IndexBuilder ¶
type IndexBuilder struct {
// contains filtered or unexported fields
}
func Index ¶
func Index(keys any) *IndexBuilder
func (*IndexBuilder) Build ¶
func (b *IndexBuilder) Build() mongo.IndexModel
func (*IndexBuilder) Name ¶
func (b *IndexBuilder) Name(name string) *IndexBuilder
type MigrationFilter ¶
type MigrationMetadata ¶
type MigrationStatus ¶
type SchemaBuilder ¶
type SchemaBuilder struct {
// contains filtered or unexported fields
}
func Schema ¶
func Schema() *SchemaBuilder
func (*SchemaBuilder) Bool ¶
func (s *SchemaBuilder) Bool() bson.M
func (*SchemaBuilder) BsonType ¶
func (s *SchemaBuilder) BsonType(t string) *SchemaBuilder
func (*SchemaBuilder) Build ¶
func (s *SchemaBuilder) Build() bson.M
func (*SchemaBuilder) Date ¶
func (s *SchemaBuilder) Date() bson.M
func (*SchemaBuilder) Field ¶
func (s *SchemaBuilder) Field(name string, value any) *SchemaBuilder
func (*SchemaBuilder) Int ¶
func (s *SchemaBuilder) Int() bson.M
func (*SchemaBuilder) Long ¶
func (s *SchemaBuilder) Long() bson.M
func (*SchemaBuilder) Properties ¶
func (s *SchemaBuilder) Properties(props bson.M) *SchemaBuilder
func (*SchemaBuilder) Required ¶
func (s *SchemaBuilder) Required(fields ...string) *SchemaBuilder
func (*SchemaBuilder) String ¶
func (s *SchemaBuilder) String() bson.M
Click to show internal directories.
Click to hide internal directories.