MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / getSchemaVersion

Function getSchemaVersion

cmd/ttn-lw-stack/commands/utils.go:139–153  ·  view source on GitHub ↗
(cl *ttnredis.Client)

Source from the content-addressed store, hash-verified

137}
138
139func getSchemaVersion(cl *ttnredis.Client) (int, error) {
140 schemaVersionString, err := cl.Get(ctx, schemaVersionKey(cl)).Result()
141 if err != nil {
142 if errors.IsNotFound(ttnredis.ConvertError(err)) {
143 return 0, nil
144 }
145 return 0, err
146 }
147 schemaVersion, err := strconv.ParseInt(schemaVersionString, 10, 32)
148 if err != nil {
149 return 0, err
150 }
151 logger.WithField("version", schemaVersion).Info("Existing database schema version")
152 return int(schemaVersion), nil
153}
154
155// telemetryConfigFallback sets the UID elements for telemetry if they are empty.
156func telemetryConfigFallback(_ context.Context, cfg *Config) {

Callers 3

js_db.goFile · 0.85
ns_db.goFile · 0.85
as_db.goFile · 0.85

Calls 6

IsNotFoundFunction · 0.92
schemaVersionKeyFunction · 0.85
ResultMethod · 0.65
GetMethod · 0.65
InfoMethod · 0.65
WithFieldMethod · 0.65

Tested by

no test coverage detected