Skip to content
Snippets Groups Projects
Commit 1348750e authored by ko_oler's avatar ko_oler
Browse files

fix

parent f2c4ed8f
No related branches found
No related tags found
No related merge requests found
...@@ -21,6 +21,8 @@ const ( ...@@ -21,6 +21,8 @@ const (
StateInstalled = pb.SpaceExtensions_INSTALLED StateInstalled = pb.SpaceExtensions_INSTALLED
StateInProgress = pb.SpaceExtensions_IN_PROGRESS StateInProgress = pb.SpaceExtensions_IN_PROGRESS
StateFail = pb.SpaceExtensions_FAIL StateFail = pb.SpaceExtensions_FAIL
ExtensionMetadataKey = "extension"
) )
type ( type (
......
...@@ -13,6 +13,7 @@ import ( ...@@ -13,6 +13,7 @@ import (
type Schema struct { type Schema struct {
field.Field field.Field
Loaded bool `json:"loaded"` Loaded bool `json:"loaded"`
Metadata map[string]string `json:"metadata"`
} }
func New(kv ...interface{}) *Schema { func New(kv ...interface{}) *Schema {
...@@ -35,6 +36,7 @@ func (s *Schema) Clone(reset bool) *Schema { ...@@ -35,6 +36,7 @@ func (s *Schema) Clone(reset bool) *Schema {
return &Schema{ return &Schema{
Field: *s.Field.Clone(reset), Field: *s.Field.Clone(reset),
Loaded: s.Loaded, Loaded: s.Loaded,
Metadata: s.Metadata,
} }
} }
...@@ -43,6 +45,21 @@ func (s Schema) WithIncludes(includes ...interface{}) *Schema { ...@@ -43,6 +45,21 @@ func (s Schema) WithIncludes(includes ...interface{}) *Schema {
return &s return &s
} }
func (s *Schema) WithMetadata(kv ...string) *Schema {
if s.Metadata == nil {
s.Metadata = make(map[string]string, len(s.Metadata))
}
for i := 0; i < len(kv); i += 2 {
s.Metadata[kv[i]] = kv[i+1]
}
return s
}
func (s Schema) SetMetadata(md map[string]string) *Schema {
s.Metadata = md
return &s
}
func (s *Schema) Load(ctx context.Context) error { func (s *Schema) Load(ctx context.Context) error {
if s.Loaded { if s.Loaded {
return nil return nil
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment