metaschema

package
v0.9.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidID         = errors.New("metaschema id is invalid")
	ErrNotExist          = errors.New("metaschema doesn't exist")
	ErrConflict          = errors.New("metaschema already exist")
	ErrInvalidDetail     = errors.New("invalid metadata detail")
	ErrInvalidMetaSchema = errors.New("metadata schema validation failed")
)

Functions

This section is empty.

Types

type MetaSchema

type MetaSchema struct {
	ID        string
	Name      string
	Schema    string
	CreatedAt time.Time
	UpdatedAt time.Time
}

MetaSchema represents metadata schema to be validated for users/ groups/ organisations / roles

type Repository

type Repository interface {
	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, id string) (string, error)
	MigrateDefaults(ctx context.Context) error
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(repository Repository) *Service

func (Service) Create

func (s Service) Create(ctx context.Context, toCreate MetaSchema) (MetaSchema, error)

func (Service) Delete

func (s Service) Delete(ctx context.Context, id string) error

func (Service) Get

func (s Service) Get(ctx context.Context, idOrName string) (MetaSchema, error)

func (Service) List

func (s Service) List(ctx context.Context) ([]MetaSchema, error)

func (Service) MigrateDefault

func (s Service) MigrateDefault(ctx context.Context) error

func (Service) Update

func (s Service) Update(ctx context.Context, id string, toUpdate MetaSchema) (MetaSchema, error)

func (Service) Validate

func (s Service) Validate(mdata metadata.Metadata, name string) error

validates the metadata against the json-schema. In case metaschema doesn't exists in the cache, it will return nil (no validation)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL