MCPcopy Create free account
hub / github.com/temporalio/temporal / validateUpdateConfig

Function validateUpdateConfig

tools/common/schema/handler.go:86–109  ·  view source on GitHub ↗
(config *UpdateConfig, db DB)

Source from the content-addressed store, hash-verified

84}
85
86func validateUpdateConfig(config *UpdateConfig, db DB) error {
87 if len(config.SchemaDir) == 0 && len(config.SchemaName) == 0 {
88 return NewConfigError("missing argument; either" + flag(CLIOptSchemaDir) + " or " +
89 flag(CLIOptSchemaName) + " must be specified")
90 }
91 if len(config.SchemaDir) > 0 && len(config.SchemaName) > 0 {
92 return NewConfigError("either" + flag(CLIOptSchemaDir) + " or " +
93 flag(CLIOptSchemaName) + " must be specified")
94 }
95 if len(config.SchemaName) > 0 {
96 if !slices.Contains(dbschemas.PathsByDB(db.Type()), config.SchemaName) {
97 return NewConfigError(fmt.Sprintf("%s must be one of: %v",
98 flag(CLIOptSchemaName), dbschemas.PathsByDB(db.Type())))
99 }
100 }
101 if len(config.TargetVersion) > 0 {
102 ver, err := normalizeVersionString(config.TargetVersion)
103 if err != nil {
104 return NewConfigError("invalid " + flag(CLIOptTargetVersion) + " argument:" + err.Error())
105 }
106 config.TargetVersion = ver
107 }
108 return nil
109}
110
111func flag(opt string) string {
112 return "(-" + opt + ")"

Callers 3

newUpdateConfigFunction · 0.85

Calls 6

NewConfigErrorFunction · 0.85
normalizeVersionStringFunction · 0.85
flagFunction · 0.70
ContainsMethod · 0.65
TypeMethod · 0.65
ErrorMethod · 0.65

Tested by 2