Base compose type def. upgrades
This commit is contained in:
36
compose/types/compose_record_store.go
Normal file
36
compose/types/compose_record_store.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package types
|
||||
|
||||
import "github.com/cortezaproject/corteza-server/compose/crs/capabilities"
|
||||
|
||||
type (
|
||||
ComposeRecordStore struct {
|
||||
ID uint64
|
||||
Handle string
|
||||
DSN string
|
||||
Location string
|
||||
// ...
|
||||
|
||||
// @todo IMO having it like so (instead of in a struct) allows for more
|
||||
// flexibility with less data
|
||||
Enforced capabilities.Set
|
||||
Supported capabilities.Set
|
||||
Unsupported capabilities.Set
|
||||
Enabled capabilities.Set
|
||||
}
|
||||
)
|
||||
|
||||
// @note this conforms to the crs.crsDefiner interface
|
||||
|
||||
func (crs ComposeRecordStore) ComposeRecordStoreID() uint64 {
|
||||
return crs.ID
|
||||
}
|
||||
|
||||
func (crs ComposeRecordStore) StoreDSN() string {
|
||||
return crs.DSN
|
||||
}
|
||||
|
||||
func (crs ComposeRecordStore) Capabilities() capabilities.Set {
|
||||
return append(crs.Enforced, crs.Supported...)
|
||||
}
|
||||
|
||||
// ---
|
||||
@@ -3,12 +3,14 @@ package types
|
||||
import (
|
||||
"database/sql/driver"
|
||||
"encoding/json"
|
||||
"time"
|
||||
|
||||
"github.com/cortezaproject/corteza-server/compose/crs/capabilities"
|
||||
discovery "github.com/cortezaproject/corteza-server/discovery/types"
|
||||
"github.com/cortezaproject/corteza-server/pkg/filter"
|
||||
"github.com/cortezaproject/corteza-server/pkg/locale"
|
||||
"github.com/jmoiron/sqlx/types"
|
||||
"github.com/pkg/errors"
|
||||
"time"
|
||||
)
|
||||
|
||||
type (
|
||||
|
||||
@@ -26,6 +26,8 @@ type (
|
||||
|
||||
Options ModuleFieldOptions `json:"options"`
|
||||
|
||||
Encoding EncodingStrategy
|
||||
|
||||
Private bool `json:"isPrivate"`
|
||||
Required bool `json:"isRequired"`
|
||||
Visible bool `json:"isVisible"`
|
||||
@@ -46,6 +48,20 @@ type (
|
||||
Label string `json:"label"`
|
||||
}
|
||||
|
||||
EncodingStrategy struct {
|
||||
*EncodingStrategyAlias
|
||||
*EncodingStrategyJSON
|
||||
}
|
||||
|
||||
EncodingStrategyAlias struct {
|
||||
Ident string `json:"ident"`
|
||||
}
|
||||
|
||||
EncodingStrategyJSON struct {
|
||||
Ident string `json:"ident"`
|
||||
Path []any `json:"path"`
|
||||
}
|
||||
|
||||
ModuleFieldFilter struct {
|
||||
ModuleID []uint64
|
||||
Deleted filter.State
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/cortezaproject/corteza-server/pkg/expr"
|
||||
"github.com/cortezaproject/corteza-server/pkg/filter"
|
||||
)
|
||||
|
||||
@@ -116,6 +117,14 @@ func (r Record) Clone() *Record {
|
||||
return c
|
||||
}
|
||||
|
||||
func (r *Record) GetValue(name string, pos int) (expr.TypedValue, error) {
|
||||
return expr.NewString("@todo")
|
||||
}
|
||||
|
||||
func (r *Record) SetValue(name string, pos int, value expr.TypedValue) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r Record) Dict() map[string]interface{} {
|
||||
dict := map[string]interface{}{
|
||||
"ID": r.ID,
|
||||
|
||||
Reference in New Issue
Block a user