Documentation ¶
Index ¶
- type MongoProvider
- func (pr *MongoProvider) Create(ctx context.Context, sec conf.Section) (string, error)
- func (pr *MongoProvider) Delete(ctx context.Context, id string) error
- func (pr *MongoProvider) Get(ctx context.Context, sectionType string) ([]runtime.Section, error)
- func (pr *MongoProvider) GetID(ctx context.Context, id string) (runtime.Section, error)
- func (pr *MongoProvider) Update(ctx context.Context, id, secType string, opts []conf.Option) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MongoProvider ¶
type MongoProvider struct {
// contains filtered or unexported fields
}
MongoProvider is a runtime.ConfigProvider that stores configuration data in a mongodb collection.
func New ¶
func New(cli *mongo.Client, dbName, colName string) *MongoProvider
New returns a new MongoDB backend runtime.ConfigProvider that stores configuration is a collection called colName inside the database dbName. Note that the database indexes should have been setup up already.
func (*MongoProvider) Create ¶
Create stores a new configuration section in the database collection. It returns the ID of the new record along with any encountered error.
func (*MongoProvider) Delete ¶
func (pr *MongoProvider) Delete(ctx context.Context, id string) error
Delete a configuration object from the database collection.
Click to show internal directories.
Click to hide internal directories.