Documentation
¶
Index ¶
- Constants
- Variables
- func Migrate(ctx context.Context, db string, version string, client *mongo.Client, ...) error
- func NewClient(ctx context.Context, c config.Reader) (*mongo.Client, error)
- func NewDataStoreWithClient(client *mongo.Client, conf ...*Config) store.DataStore
- func SetupDataStore(conf *Config) (store.DataStore, error)
- type Config
- type DataStoreMongo
Constants ¶
View Source
const ( CollNameSettings = "settings" KeyTenantID = "tenant_id" ConnectTimeoutSeconds = 10 )
View Source
const ( // DbVersion is the current schema version DbVersion = "1.0.0" // DbName is the database name DbName = "azure_iot_manager" )
View Source
const (
IndexNameSettingsGet = "settings get"
)
Variables ¶
View Source
var (
ErrFailedToGetSettings = errors.New("Failed to get settings")
)
Functions ¶
func Migrate ¶
func Migrate(ctx context.Context, db string, version string, client *mongo.Client, automigrate bool) error
Migrate applies migrations to the database
func NewDataStoreWithClient ¶
NewDataStoreWithClient initializes a DataStore object
Types ¶
type DataStoreMongo ¶
type DataStoreMongo struct { *Config // contains filtered or unexported fields }
DataStoreMongo is the data storage service
func (*DataStoreMongo) Close ¶
func (db *DataStoreMongo) Close() error
func (*DataStoreMongo) GetSettings ¶
func (*DataStoreMongo) Ping ¶
func (db *DataStoreMongo) Ping(ctx context.Context) error
Ping verifies the connection to the database
func (*DataStoreMongo) SetSettings ¶
Click to show internal directories.
Click to hide internal directories.