datamodel

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ImportDataModels = "ImportDataModels"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateParam

type CreateParam struct {
	WorkspaceID string
	Name        string
	Type        string
	Headers     []string
	Rows        [][]string
}

type DataModel

type DataModel struct {
	WorkspaceID string
	ID          string
	Name        string
	Type        string
	CreatedAt   time.Time
	UpdatedAt   time.Time
	Headers     []string   // all headers in this data model
	RowIDs      []string   // all rowIDs in this data model, only used in delete data model
	Rows        [][]string // the row should be saved(create/update)
}

type Factory

type Factory struct{}

Factory workspace factory.

func NewDataModelFactory

func NewDataModelFactory() *Factory

NewDataModelFactory return a workspace factory.

func (*Factory) New

func (f *Factory) New(param *CreateParam) *DataModel

type Grid

type Grid struct {
	Value []byte `json:"value"`
	Type  string `json:"type"`
}

type ImportDataModelsEvent

type ImportDataModelsEvent struct {
	WorkspaceID       string
	Schemas           []schema.DataModelTypedSchema
	ImportFileBaseDir string
}

func NewImportDataModelsEvent

func NewImportDataModelsEvent(workspaceID, baseDir string, schemas []schema.DataModelTypedSchema) *ImportDataModelsEvent

func NewImportDataModelsEventFromPayload

func NewImportDataModelsEventFromPayload(data []byte) (*ImportDataModelsEvent, error)

func (*ImportDataModelsEvent) Delay

func (e *ImportDataModelsEvent) Delay() time.Duration

func (*ImportDataModelsEvent) EventType

func (e *ImportDataModelsEvent) EventType() string

func (*ImportDataModelsEvent) Payload

func (e *ImportDataModelsEvent) Payload() []byte

type ImportDataModelsHandler

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

func NewImportDataModelsHandler

func NewImportDataModelsHandler(repo Repository, bus eventbus.EventBus, factory *Factory) *ImportDataModelsHandler

func (*ImportDataModelsHandler) Handle

type Repository

type Repository interface {
	Save(ctx context.Context, dm *DataModel) error
	Get(ctx context.Context, id string) (*DataModel, error)
	Delete(ctx context.Context, dm *DataModel) error
}

Repository allows to get/save events from/to event store.

type Row

type Row struct {
	Grids []*Grid `json:"grids"`
}

type Service

type Service interface {
	Get(context.Context, string) (*DataModel, error)
	Upsert(context.Context, *DataModel) error
	Create(context.Context, *DataModel) error
	Update(context.Context, *DataModel) error
	Delete(context.Context, *DataModel) error
}

func NewService

func NewService(repo Repository, eventbus eventbus.EventBus, factory *Factory) Service

Jump to

Keyboard shortcuts

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