29 lines
460 B
Go
29 lines
460 B
Go
package block
|
|
|
|
import (
|
|
"blocky/internal/block/validation"
|
|
"encoding/json"
|
|
)
|
|
|
|
type ComponentType int8
|
|
|
|
const (
|
|
_ ComponentType = iota
|
|
TextComponentType
|
|
Int64ComponentType
|
|
Date
|
|
)
|
|
|
|
type Component interface {
|
|
Type() ComponentType
|
|
Identifier() string
|
|
Name() string
|
|
NewInstance() ComponentInstance
|
|
Validators() []validation.Validator
|
|
}
|
|
|
|
type ComponentInstance interface {
|
|
FromJSON(component Component, data json.RawMessage) error
|
|
Value() interface{}
|
|
}
|