Documentation
¶
Index ¶
- Variables
- func Collections() []string
- func ImportIndexesFromMongo(ctx context.Context, db *mongo.Database) (int, error)
- func IndexesByCollection() map[string][]IndexSpec
- func MustRegister(specs ...IndexSpec)
- func MustRegisterCollections(names ...string)
- func MustRegisterValidator(specs ...ValidatorSpec)
- func Register(spec IndexSpec) error
- func RegisterCollection(name string) error
- func RegisterValidator(spec ValidatorSpec) error
- type IndexSpec
- type ValidatorSpec
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrIndexCollectionRequired = errors.New("index collection is required") ErrIndexNameRequired = errors.New("index name is required") ErrIndexMustDefineKey = errors.New("index must define at least one key") ErrIndexAlreadyRegistered = errors.New("index already registered") )
View Source
var (
ErrCollectionNameRequired = errors.New("collection name is required")
)
Functions ¶
func Collections ¶
func Collections() []string
func ImportIndexesFromMongo ¶
func IndexesByCollection ¶
IndexesByCollection groups specs by collection name.
func MustRegister ¶
func MustRegister(specs ...IndexSpec)
MustRegister adds specs and panics if any registration fails.
func MustRegisterCollections ¶
func MustRegisterCollections(names ...string)
func MustRegisterValidator ¶
func MustRegisterValidator(specs ...ValidatorSpec)
func RegisterCollection ¶
func RegisterValidator ¶
func RegisterValidator(spec ValidatorSpec) error
Types ¶
type IndexSpec ¶
type IndexSpec struct {
Collection string
Name string
Keys bson.D
Unique bool
Sparse bool
PartialFilter bson.D
ExpireAfterSeconds *int32
AdditionalStatement string
}
func (IndexSpec) PartialFilterString ¶
PartialFilterString renders the partial filter expression, if any.
type ValidatorSpec ¶
type ValidatorSpec struct {
Collection string
Description string
Schema bson.M
Level string // off, moderate, strict
}
func Validators ¶
func Validators() []ValidatorSpec
Click to show internal directories.
Click to hide internal directories.