-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update metaschema table schema
- Loading branch information
1 parent
d944a0b
commit 24f7e9c
Showing
7 changed files
with
111 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,25 @@ | ||
package metaschema | ||
|
||
import "context" | ||
import ( | ||
"context" | ||
"time" | ||
) | ||
|
||
type Repository interface { | ||
Create(ctx context.Context, metaschema MetaSchema) (string, error) | ||
Get(ctx context.Context, name string) (MetaSchema, error) | ||
Update(ctx context.Context, name string, metaschema MetaSchema) (string, error) | ||
Create(ctx context.Context, metaschema MetaSchema) (MetaSchema, error) | ||
Get(ctx context.Context, id string) (MetaSchema, error) | ||
Update(ctx context.Context, id string, metaschema MetaSchema) (MetaSchema, error) | ||
List(ctx context.Context) ([]MetaSchema, error) | ||
Delete(ctx context.Context, name string) error | ||
Delete(ctx context.Context, id string) error | ||
CreateDefaultInDB(ctx context.Context) error | ||
InitMetaSchemas(ctx context.Context) (map[string]string, error) | ||
} | ||
|
||
// MetaSchema represents metadata schema to be validated for users/ groups/ organisations / roles | ||
type MetaSchema struct { | ||
Name string | ||
Schema string | ||
ID string | ||
Name string | ||
Schema string | ||
CreatedAt time.Time | ||
UpdatedAt time.Time | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
package postgres | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/odpf/shield/core/metaschema" | ||
) | ||
|
||
type MetaSchema struct { | ||
Name string | ||
Schema string | ||
ID string `db:"id"` | ||
Name string `db:"name"` | ||
Schema string `db:"schema"` | ||
CreatedAt time.Time `db:"created_at"` | ||
UpdatedAt time.Time `db:"updated_at"` | ||
} | ||
|
||
func (from MetaSchema) tranformtoMetadataSchema() metaschema.MetaSchema { | ||
return metaschema.MetaSchema{ | ||
Name: from.Name, | ||
Schema: from.Schema, | ||
ID: from.ID, | ||
Name: from.Name, | ||
Schema: from.Schema, | ||
CreatedAt: from.CreatedAt, | ||
UpdatedAt: from.UpdatedAt, | ||
} | ||
} |
Oops, something went wrong.