types

package
Version: v0.0.0-...-aedab82 Latest Latest
Warning

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

Go to latest
Published: May 10, 2022 License: Apache-2.0 Imports: 15 Imported by: 6

Documentation

Index

Constants

View Source
const (
	PageAttachment      string = "page"
	RecordAttachment    string = "record"
	NamespaceAttachment string = "namespace"
)
View Source
const (
	ModuleResourceTranslationType      = "compose:module"
	ModuleFieldResourceTranslationType = "compose:module-field"
	NamespaceResourceTranslationType   = "compose:namespace"
	PageResourceTranslationType        = "compose:page"
)

Types and stuff

View Source
const (
	ChartResourceType       = "corteza::compose:chart"
	ModuleResourceType      = "corteza::compose:module"
	ModuleFieldResourceType = "corteza::compose:module-field"
	NamespaceResourceType   = "corteza::compose:namespace"
	PageResourceType        = "corteza::compose:page"
	RecordResourceType      = "corteza::compose:record"
	ComponentResourceType   = "corteza::compose"
)

Variables

View Source
var (
	// @todo can we remove LocaleKey struct for string constant?
	LocaleKeyModuleName                                     = LocaleKey{Path: "name"}
	LocaleKeyModuleFieldLabel                               = LocaleKey{Path: "label"}
	LocaleKeyModuleFieldMetaDescriptionView                 = LocaleKey{Path: "meta.description.view"}
	LocaleKeyModuleFieldMetaDescriptionEdit                 = LocaleKey{Path: "meta.description.edit"}
	LocaleKeyModuleFieldMetaHintView                        = LocaleKey{Path: "meta.hint.view"}
	LocaleKeyModuleFieldMetaHintEdit                        = LocaleKey{Path: "meta.hint.edit"}
	LocaleKeyModuleFieldExpressionValidatorValidatorIDError = LocaleKey{Path: "expression.validator.{{validatorID}}.error"}
	LocaleKeyModuleFieldMetaOptionsValueText                = LocaleKey{Path: "meta.options.{{value}}.text"}
	LocaleKeyModuleFieldMetaBoolValueLabel                  = LocaleKey{Path: "meta.bool.{{value}}.label"}
	LocaleKeyNamespaceName                                  = LocaleKey{Path: "name"}
	LocaleKeyNamespaceMetaSubtitle                          = LocaleKey{Path: "meta.subtitle"}
	LocaleKeyNamespaceMetaDescription                       = LocaleKey{Path: "meta.description"}
	LocaleKeyPageTitle                                      = LocaleKey{Path: "title"}
	LocaleKeyPageDescription                                = LocaleKey{Path: "description"}
	LocaleKeyPageRecordToolbarNewLabel                      = LocaleKey{Path: "recordToolbar.new.label"}
	LocaleKeyPageRecordToolbarEditLabel                     = LocaleKey{Path: "recordToolbar.edit.label"}
	LocaleKeyPageRecordToolbarSubmitLabel                   = LocaleKey{Path: "recordToolbar.submit.label"}
	LocaleKeyPageRecordToolbarDeleteLabel                   = LocaleKey{Path: "recordToolbar.delete.label"}
	LocaleKeyPageRecordToolbarCloneLabel                    = LocaleKey{Path: "recordToolbar.clone.label"}
	LocaleKeyPageRecordToolbarBackLabel                     = LocaleKey{Path: "recordToolbar.back.label"}
	LocaleKeyPagePageBlockBlockIDTitle                      = LocaleKey{Path: "pageBlock.{{blockID}}.title"}
	LocaleKeyPagePageBlockBlockIDDescription                = LocaleKey{Path: "pageBlock.{{blockID}}.description"}
	LocaleKeyPagePageBlockBlockIDButtonButtonIDLabel        = LocaleKey{Path: "pageBlock.{{blockID}}.button.{{buttonID}}.label"}
	LocaleKeyPagePageBlockBlockIDContentBody                = LocaleKey{Path: "pageBlock.{{blockID}}.content.body"}
)

Functions

func ChartRbacResource

func ChartRbacResource(namespaceID uint64, id uint64) string

ChartRbacResource returns string representation of RBAC resource for Chart

RBAC resource is in the corteza::compose:chart/... format

This function is auto-generated

func ChartRbacResourceTpl

func ChartRbacResourceTpl() string

func ComponentRbacResource

func ComponentRbacResource() string

ComponentRbacResource returns string representation of RBAC resource for Component

RBAC resource is in the corteza::compose/ format

This function is auto-generated

func ComponentRbacResourceTpl

func ComponentRbacResourceTpl() string

func ModuleFieldRbacResource

func ModuleFieldRbacResource(namespaceID uint64, moduleID uint64, id uint64) string

ModuleFieldRbacResource returns string representation of RBAC resource for ModuleField

RBAC resource is in the corteza::compose:module-field/... format

This function is auto-generated

func ModuleFieldRbacResourceTpl

func ModuleFieldRbacResourceTpl() string

func ModuleFieldResourceTranslation

func ModuleFieldResourceTranslation(NamespaceID uint64, ModuleID uint64, ID uint64) string

ModuleFieldResourceTranslation returns string representation of Locale resource for ModuleField

Locale resource is in the compose:module-field/... format

This function is auto-generated

func ModuleFieldResourceTranslationTpl

func ModuleFieldResourceTranslationTpl() string

func ModuleRbacResource

func ModuleRbacResource(namespaceID uint64, id uint64) string

ModuleRbacResource returns string representation of RBAC resource for Module

RBAC resource is in the corteza::compose:module/... format

This function is auto-generated

func ModuleRbacResourceTpl

func ModuleRbacResourceTpl() string

func ModuleResourceTranslation

func ModuleResourceTranslation(NamespaceID uint64, ID uint64) string

ModuleResourceTranslation returns string representation of Locale resource for Module

Locale resource is in the compose:module/... format

This function is auto-generated

func ModuleResourceTranslationTpl

func ModuleResourceTranslationTpl() string

func NamespaceRbacResource

func NamespaceRbacResource(id uint64) string

NamespaceRbacResource returns string representation of RBAC resource for Namespace

RBAC resource is in the corteza::compose:namespace/... format

This function is auto-generated

func NamespaceRbacResourceTpl

func NamespaceRbacResourceTpl() string

func NamespaceResourceTranslation

func NamespaceResourceTranslation(ID uint64) string

NamespaceResourceTranslation returns string representation of Locale resource for Namespace

Locale resource is in the compose:namespace/... format

This function is auto-generated

func NamespaceResourceTranslationTpl

func NamespaceResourceTranslationTpl() string

func PageRbacResource

func PageRbacResource(namespaceID uint64, id uint64) string

PageRbacResource returns string representation of RBAC resource for Page

RBAC resource is in the corteza::compose:page/... format

This function is auto-generated

func PageRbacResourceTpl

func PageRbacResourceTpl() string

func PageResourceTranslation

func PageResourceTranslation(NamespaceID uint64, ID uint64) string

PageResourceTranslation returns string representation of Locale resource for Page

Locale resource is in the compose:page/... format

This function is auto-generated

func PageResourceTranslationTpl

func PageResourceTranslationTpl() string

func RecordRbacResource

func RecordRbacResource(namespaceID uint64, moduleID uint64, id uint64) string

RecordRbacResource returns string representation of RBAC resource for Record

RBAC resource is in the corteza::compose:record/... format

This function is auto-generated

func RecordRbacResourceTpl

func RecordRbacResourceTpl() string

Types

type Attachment

type Attachment struct {
	ID         uint64         `json:"attachmentID,string"`
	OwnerID    uint64         `json:"ownerID,string"`
	Kind       string         `json:"-"`
	Url        string         `json:"url,omitempty"`
	PreviewUrl string         `json:"previewUrl,omitempty"`
	Name       string         `json:"name,omitempty"`
	Meta       AttachmentMeta `json:"meta"`

	NamespaceID uint64 `json:"namespaceID,string"`

	CreatedAt time.Time  `json:"createdAt,omitempty"`
	UpdatedAt *time.Time `json:"updatedAt,omitempty"`
	DeletedAt *time.Time `json:"deletedAt,omitempty"`
}

func (*Attachment) SetOriginalImageMeta

func (a *Attachment) SetOriginalImageMeta(width, height int, animated bool) *AttachmentFileMeta

func (*Attachment) SetPreviewImageMeta

func (a *Attachment) SetPreviewImageMeta(width, height int, animated bool) *AttachmentFileMeta

type AttachmentFileMeta

type AttachmentFileMeta struct {
	Size      int64                `json:"size"`
	Extension string               `json:"ext"`
	Mimetype  string               `json:"mimetype"`
	Image     *AttachmentImageMeta `json:"image,omitempty"`
}

type AttachmentFilter

type AttachmentFilter struct {
	NamespaceID uint64 `json:"namespaceID,string"`
	Kind        string `json:"kind,omitempty"`
	PageID      uint64 `json:"pageID,string,omitempty"`
	RecordID    uint64 `json:"recordID,string,omitempty"`
	ModuleID    uint64 `json:"moduleID,string,omitempty"`
	FieldName   string `json:"fieldName,omitempty"`
	Filter      string `json:"filter"`

	// Check fn is called by store backend for each resource found function can
	// modify the resource and return false if store should not return it
	//
	// Store then loads additional resources to satisfy the paging parameters
	Check func(*Attachment) (bool, error)

	// Standard helpers for paging and sorting
	filter.Sorting
	filter.Paging
}

AttachmentFilter is used for filtering and as a return value from Find

type AttachmentImageMeta

type AttachmentImageMeta struct {
	Width    int  `json:"width,omitempty"`
	Height   int  `json:"height,omitempty"`
	Animated bool `json:"animated"`
}

type AttachmentMeta

type AttachmentMeta struct {
	Original AttachmentFileMeta  `json:"original"`
	Preview  *AttachmentFileMeta `json:"preview,omitempty"`
}

func (*AttachmentMeta) Scan

func (meta *AttachmentMeta) Scan(value interface{}) error

func (AttachmentMeta) Value

func (meta AttachmentMeta) Value() (driver.Value, error)

type AttachmentSet

type AttachmentSet []*Attachment

AttachmentSet slice of Attachment

This type is auto-generated.

func (AttachmentSet) Filter

func (set AttachmentSet) Filter(f func(*Attachment) (bool, error)) (out AttachmentSet, err error)

Filter iterates through every slice item, calls f(Attachment) (bool, err) and return filtered slice

This function is auto-generated.

func (AttachmentSet) FindByID

func (set AttachmentSet) FindByID(ID uint64) *Attachment

FindByID finds items from slice by its ID property

This function is auto-generated.

func (AttachmentSet) IDs

func (set AttachmentSet) IDs() (IDs []uint64)

IDs returns a slice of uint64s from all items in the set

This function is auto-generated.

func (AttachmentSet) Walk

func (set AttachmentSet) Walk(w func(*Attachment) error) (err error)

Walk iterates through every slice item and calls w(Attachment) err

This function is auto-generated.

type Chart

type Chart struct {
	ID     uint64      `json:"chartID,string"`
	Handle string      `json:"handle"`
	Name   string      `json:"name"`
	Config ChartConfig `json:"config"`

	Labels map[string]string `json:"labels,omitempty"`

	NamespaceID uint64 `json:"namespaceID,string"`

	CreatedAt time.Time  `json:"createdAt,omitempty"`
	UpdatedAt *time.Time `json:"updatedAt,omitempty"`
	DeletedAt *time.Time `json:"deletedAt,omitempty"`
}

func (Chart) GetLabels

func (m Chart) GetLabels() map[string]string

GetLabels adds new label to label map

func (Chart) LabelResourceID

func (m Chart) LabelResourceID() uint64

GetLabels adds new label to label map

func (Chart) LabelResourceKind

func (Chart) LabelResourceKind() string

GetLabels adds new label to label map

func (Chart) RbacResource

func (r Chart) RbacResource() string

RbacResource returns string representation of RBAC resource for Chart by calling ChartRbacResource fn

RBAC resource is in the corteza::compose:chart/... format

This function is auto-generated

func (*Chart) SetLabel

func (m *Chart) SetLabel(key string, value string)

SetLabel adds new label to label map

type ChartConfig

type ChartConfig struct {
	Reports     []*ChartConfigReport `json:"reports,omitempty"`
	ColorScheme string               `json:"colorScheme,omitempty"`
}

func (*ChartConfig) Scan

func (cc *ChartConfig) Scan(value interface{}) error

func (ChartConfig) Value

func (cc ChartConfig) Value() (driver.Value, error)

type ChartConfigReport

type ChartConfigReport struct {
	Filter     string                   `json:"filter"`
	ModuleID   uint64                   `json:"moduleID,string,omitempty"`
	Metrics    []map[string]interface{} `json:"metrics,omitempty"`
	Dimensions []map[string]interface{} `json:"dimensions,omitempty"`
	YAxis      map[string]interface{}   `json:"yAxis,omitempty"`
	Renderer   struct {
		Version string `json:"version,omitempty" `
	} `json:"renderer,omitempty"`
}

type ChartFilter

type ChartFilter struct {
	NamespaceID uint64   `json:"namespaceID,string"`
	ChartID     []uint64 `json:"chartID"`
	Handle      string   `json:"handle"`
	Name        string   `json:"name"`
	Query       string   `json:"query"`

	LabeledIDs []uint64          `json:"-"`
	Labels     map[string]string `json:"labels,omitempty"`

	Deleted filter.State `json:"deleted"`

	// Check fn is called by store backend for each resource found function can
	// modify the resource and return false if store should not return it
	//
	// Store then loads additional resources to satisfy the paging parameters
	Check func(*Chart) (bool, error) `json:"-"`

	// Standard helpers for paging and sorting
	filter.Sorting
	filter.Paging
}

type ChartSet

type ChartSet []*Chart

ChartSet slice of Chart

This type is auto-generated.

func (ChartSet) Filter

func (set ChartSet) Filter(f func(*Chart) (bool, error)) (out ChartSet, err error)

Filter iterates through every slice item, calls f(Chart) (bool, err) and return filtered slice

This function is auto-generated.

func (ChartSet) FindByHandle

func (set ChartSet) FindByHandle(handle string) *Chart

FindByHandle finds chart by it's handle

func (ChartSet) FindByID

func (set ChartSet) FindByID(ID uint64) *Chart

FindByID finds items from slice by its ID property

This function is auto-generated.

func (ChartSet) IDs

func (set ChartSet) IDs() (IDs []uint64)

IDs returns a slice of uint64s from all items in the set

This function is auto-generated.

func (ChartSet) Walk

func (set ChartSet) Walk(w func(*Chart) error) (err error)

Walk iterates through every slice item and calls w(Chart) err

This function is auto-generated.

type Component

type Component struct{}

Component struct serves as a virtual resource type for the compose component

This struct is auto-generated

func (Component) RbacResource

func (r Component) RbacResource() string

RbacResource returns string representation of RBAC resource for Component by calling ComponentRbacResource fn

RBAC resource is in the corteza::compose/... format

This function is auto-generated

type EmailNotification

type EmailNotification struct {
	To                []string
	Cc                []string
	ReplyTo           string
	Subject           string
	ContentPlain      string
	ContentHTML       string
	RemoteAttachments []string
}

type LocaleKey

type LocaleKey struct {
	Name          string
	Resource      string
	Path          string
	CustomHandler string
}

type Module

type Module struct {
	ID     uint64         `json:"moduleID,string"`
	Handle string         `json:"handle"`
	Meta   types.JSONText `json:"meta"`
	Fields ModuleFieldSet `json:"fields"`

	Labels map[string]string `json:"labels,omitempty"`

	NamespaceID uint64 `json:"namespaceID,string"`

	CreatedAt time.Time  `json:"createdAt,omitempty"`
	UpdatedAt *time.Time `json:"updatedAt,omitempty"`
	DeletedAt *time.Time `json:"deletedAt,omitempty"`

	// Warning: value of this field is now handled via resource-translation facility
	//          struct field is kept for the convenience for now since it allows us
	//          easy encoding/decoding of the outgoing/incoming values
	Name string `json:"name"`
}

func (Module) Clone

func (m Module) Clone() *Module

func (*Module) DecodeTranslations

func (r *Module) DecodeTranslations(tt locale.ResourceTranslationIndex)

func (*Module) EncodeTranslations

func (r *Module) EncodeTranslations() (out locale.ResourceTranslationSet)

func (Module) GetLabels

func (m Module) GetLabels() map[string]string

GetLabels adds new label to label map

func (Module) LabelResourceID

func (m Module) LabelResourceID() uint64

GetLabels adds new label to label map

func (Module) LabelResourceKind

func (Module) LabelResourceKind() string

GetLabels adds new label to label map

func (Module) RbacResource

func (r Module) RbacResource() string

RbacResource returns string representation of RBAC resource for Module by calling ModuleRbacResource fn

RBAC resource is in the corteza::compose:module/... format

This function is auto-generated

func (Module) ResourceTranslation

func (r Module) ResourceTranslation() string

ResourceTranslation returns string representation of Locale resource for Module by calling ModuleResourceTranslation fn

Locale resource is in "compose:module/..." format

This function is auto-generated

func (*Module) SetLabel

func (m *Module) SetLabel(key string, value string)

SetLabel adds new label to label map

type ModuleField

type ModuleField struct {
	ID          uint64 `json:"fieldID,string"`
	NamespaceID uint64 `json:"namspaceID,string"`
	ModuleID    uint64 `json:"moduleID,string"`
	Place       int    `json:"-"`

	Kind string `json:"kind"`
	Name string `json:"name"`

	Options ModuleFieldOptions `json:"options"`

	Private      bool           `json:"isPrivate"`
	Required     bool           `json:"isRequired"`
	Visible      bool           `json:"isVisible"`
	Multi        bool           `json:"isMulti"`
	DefaultValue RecordValueSet `json:"defaultValue"`

	Expressions ModuleFieldExpr `json:"expressions"`

	Labels map[string]string `json:"labels,omitempty"`

	CreatedAt time.Time  `json:"createdAt,omitempty"`
	UpdatedAt *time.Time `json:"updatedAt,omitempty"`
	DeletedAt *time.Time `json:"deletedAt,omitempty"`

	// Warning: value of this field is now handled via resource-translation facility
	//          struct field is kept for the convenience for now since it allows us
	//          easy encoding/decoding of the outgoing/incoming values
	Label string `json:"label"`
}

Modules - CRM module definitions

func (ModuleField) Clone

func (f ModuleField) Clone() *ModuleField

func (*ModuleField) DecodeTranslations

func (r *ModuleField) DecodeTranslations(tt locale.ResourceTranslationIndex)

func (*ModuleField) EncodeTranslations

func (r *ModuleField) EncodeTranslations() (out locale.ResourceTranslationSet)

func (ModuleField) GetLabels

func (m ModuleField) GetLabels() map[string]string

GetLabels adds new label to label map

func (ModuleField) IsBoolean

func (f ModuleField) IsBoolean() bool

func (ModuleField) IsDateOnly

func (f ModuleField) IsDateOnly() bool

func (ModuleField) IsDateTime

func (f ModuleField) IsDateTime() bool

func (ModuleField) IsNumeric

func (f ModuleField) IsNumeric() bool

func (ModuleField) IsRef

func (f ModuleField) IsRef() bool

IsRef tells us if value of this field be a reference to something (another record, file , user)?

func (ModuleField) IsTimeOnly

func (f ModuleField) IsTimeOnly() bool

func (ModuleField) LabelResourceID

func (m ModuleField) LabelResourceID() uint64

GetLabels adds new label to label map

func (ModuleField) LabelResourceKind

func (ModuleField) LabelResourceKind() string

GetLabels adds new label to label map

func (ModuleField) RbacResource

func (r ModuleField) RbacResource() string

RbacResource returns string representation of RBAC resource for ModuleField by calling ModuleFieldRbacResource fn

RBAC resource is in the corteza::compose:module-field/... format

This function is auto-generated

func (ModuleField) ResourceTranslation

func (r ModuleField) ResourceTranslation() string

ResourceTranslation returns string representation of Locale resource for ModuleField by calling ModuleFieldResourceTranslation fn

Locale resource is in "compose:module-field/..." format

This function is auto-generated

func (*ModuleField) SetLabel

func (m *ModuleField) SetLabel(key string, value string)

SetLabel adds new label to label map

type ModuleFieldExpr

type ModuleFieldExpr struct {
	ValueExpr string `json:"value,omitempty"`

	Sanitizers []string `json:"sanitizers,omitempty"`

	Validators               []ModuleFieldValidator `json:"validators,omitempty"`
	DisableDefaultValidators bool                   `json:"disableDefaultValidators,omitempty"`

	Formatters               []string `json:"formatters,omitempty"`
	DisableDefaultFormatters bool     `json:"disableDefaultFormatters,omitempty"`
}

func (*ModuleFieldExpr) Scan

func (opt *ModuleFieldExpr) Scan(value interface{}) error

func (ModuleFieldExpr) Value

func (opt ModuleFieldExpr) Value() (driver.Value, error)

type ModuleFieldFilter

type ModuleFieldFilter struct {
	ModuleID []uint64
	Deleted  filter.State
	Limit    uint
}

type ModuleFieldOptionIndex

type ModuleFieldOptionIndex struct {
	// index values in this field for public, protected or private  searches
	Access discovery.Access `json:"access"`

	// Applicable to ref field kinds where we use nested/object type
	// and we want to control how deep do we want to follow the references
	NestingDepth map[string]bool `json:"nestingDepth,omitempty"`

	// When embedding this field into a parent doc, do we skip it?
	SkipNested bool `json:"skipNested,omitempty"`
}

type ModuleFieldOptions

type ModuleFieldOptions map[string]interface{}

func (ModuleFieldOptions) Bool

func (opt ModuleFieldOptions) Bool(key string) bool

Bool returns option value for key as boolean true or false

Invalid, non-existing are returned as false

func (ModuleFieldOptions) Index

IsUnique - should value in this field be unique across records?

func (ModuleFieldOptions) Int64

func (opt ModuleFieldOptions) Int64(key string) int64

func (ModuleFieldOptions) Int64Def

func (opt ModuleFieldOptions) Int64Def(key string, def int64) int64

func (ModuleFieldOptions) IsUnique

func (opt ModuleFieldOptions) IsUnique() bool

IsUnique - should value in this field be unique across records?

func (ModuleFieldOptions) IsUniqueMultiValue

func (opt ModuleFieldOptions) IsUniqueMultiValue() bool

IsUniqueMultiValue - should value in this field be unique in the multi-value set?

func (ModuleFieldOptions) Precision

func (opt ModuleFieldOptions) Precision() (p uint)

func (*ModuleFieldOptions) Scan

func (opt *ModuleFieldOptions) Scan(value interface{}) error

func (ModuleFieldOptions) SetIsUnique

func (opt ModuleFieldOptions) SetIsUnique(value bool)

SetIsUnique - should value in this field be unique across records?

func (ModuleFieldOptions) SetIsUniqueMultiValue

func (opt ModuleFieldOptions) SetIsUniqueMultiValue(value bool)

func (ModuleFieldOptions) SetPrecision

func (opt ModuleFieldOptions) SetPrecision(p uint)

func (ModuleFieldOptions) String

func (opt ModuleFieldOptions) String(key string) string

String returns option value for key as single string

Invalid, non-existing are returned as empty string ("")

func (ModuleFieldOptions) Strings

func (opt ModuleFieldOptions) Strings(key string) []string

Strings returns option value for key as slice of strings

Invalid, non-existing are returned as nil

func (ModuleFieldOptions) UInt64

func (opt ModuleFieldOptions) UInt64(key string) uint64

func (ModuleFieldOptions) UInt64Def

func (opt ModuleFieldOptions) UInt64Def(key string, def uint64) uint64

func (ModuleFieldOptions) Uint64

func (opt ModuleFieldOptions) Uint64(key string) uint64

Uint64 returns option value for key casted to uint64

func (ModuleFieldOptions) Value

func (opt ModuleFieldOptions) Value() (driver.Value, error)

type ModuleFieldSet

type ModuleFieldSet []*ModuleField

ModuleFieldSet slice of ModuleField

This type is auto-generated.

func (ModuleFieldSet) Clone

func (set ModuleFieldSet) Clone() (out ModuleFieldSet)

func (ModuleFieldSet) Filter

func (set ModuleFieldSet) Filter(f func(*ModuleField) (bool, error)) (out ModuleFieldSet, err error)

Filter iterates through every slice item, calls f(ModuleField) (bool, err) and return filtered slice

This function is auto-generated.

func (ModuleFieldSet) FilterByModule

func (set ModuleFieldSet) FilterByModule(moduleID uint64) (ff ModuleFieldSet)

func (ModuleFieldSet) FindByID

func (set ModuleFieldSet) FindByID(ID uint64) *ModuleField

FindByID finds items from slice by its ID property

This function is auto-generated.

func (ModuleFieldSet) FindByName

func (set ModuleFieldSet) FindByName(name string) *ModuleField

func (ModuleFieldSet) HasName

func (set ModuleFieldSet) HasName(name string) bool

func (ModuleFieldSet) IDs

func (set ModuleFieldSet) IDs() (IDs []uint64)

IDs returns a slice of uint64s from all items in the set

This function is auto-generated.

func (ModuleFieldSet) Len

func (set ModuleFieldSet) Len() int

func (ModuleFieldSet) Less

func (set ModuleFieldSet) Less(i, j int) bool

func (ModuleFieldSet) Names

func (set ModuleFieldSet) Names() (names []string)

func (*ModuleFieldSet) Scan

func (set *ModuleFieldSet) Scan(src interface{}) error

func (ModuleFieldSet) Swap

func (set ModuleFieldSet) Swap(i, j int)

func (ModuleFieldSet) Value

func (set ModuleFieldSet) Value() (driver.Value, error)

func (ModuleFieldSet) Walk

func (set ModuleFieldSet) Walk(w func(*ModuleField) error) (err error)

Walk iterates through every slice item and calls w(ModuleField) err

This function is auto-generated.

type ModuleFieldValidator

type ModuleFieldValidator struct {
	ValidatorID uint64 `json:"validatorID,string,omitempty"`
	Test        string `json:"test,omitempty"`
	Error       string `json:"error,omitempty"`
}

type ModuleFilter

type ModuleFilter struct {
	ModuleID    []uint64 `json:"moduleID"`
	NamespaceID uint64   `json:"namespaceID,string"`
	Query       string   `json:"query"`
	Handle      string   `json:"handle"`
	Name        string   `json:"name"`

	LabeledIDs []uint64          `json:"-"`
	Labels     map[string]string `json:"labels,omitempty"`

	Deleted filter.State `json:"deleted"`

	// Check fn is called by store backend for each resource found function can
	// modify the resource and return false if store should not return it
	//
	// Store then loads additional resources to satisfy the paging parameters
	Check func(*Module) (bool, error) `json:"-"`

	// Standard helpers for paging and sorting
	filter.Sorting
	filter.Paging
}

type ModuleMeta

type ModuleMeta struct {
	Discovery discovery.ModuleMeta `json:"discovery"`
}

func (*ModuleMeta) Scan

func (nm *ModuleMeta) Scan(value interface{}) error

func (ModuleMeta) Value

func (nm ModuleMeta) Value() (driver.Value, error)

type ModuleSet

type ModuleSet []*Module

ModuleSet slice of Module

This type is auto-generated.

func (ModuleSet) Filter

func (set ModuleSet) Filter(f func(*Module) (bool, error)) (out ModuleSet, err error)

Filter iterates through every slice item, calls f(Module) (bool, err) and return filtered slice

This function is auto-generated.

func (ModuleSet) FindByHandle

func (set ModuleSet) FindByHandle(handle string) *Module

FindByHandle finds module by it's handle

func (ModuleSet) FindByID

func (set ModuleSet) FindByID(ID uint64) *Module

FindByID finds items from slice by its ID property

This function is auto-generated.

func (ModuleSet) IDs

func (set ModuleSet) IDs() (IDs []uint64)

IDs returns a slice of uint64s from all items in the set

This function is auto-generated.

func (ModuleSet) Walk

func (set ModuleSet) Walk(w func(*Module) error) (err error)

Walk iterates through every slice item and calls w(Module) err

This function is auto-generated.

type Namespace

type Namespace struct {
	ID      uint64        `json:"namespaceID,string"`
	Slug    string        `json:"slug"`
	Enabled bool          `json:"enabled"`
	Meta    NamespaceMeta `json:"meta"`

	Labels map[string]string `json:"labels,omitempty"`

	CreatedAt time.Time  `json:"createdAt,omitempty"`
	UpdatedAt *time.Time `json:"updatedAt,omitempty"`
	DeletedAt *time.Time `json:"deletedAt,omitempty"`

	// Warning: value of this field is now handled via resource-translation facility
	//          struct field is kept for the convenience for now since it allows us
	//          easy encoding/decoding of the outgoing/incoming values
	Name string `json:"name"`
}

func (Namespace) Clone

func (n Namespace) Clone() *Namespace

func (*Namespace) DecodeTranslations

func (r *Namespace) DecodeTranslations(tt locale.ResourceTranslationIndex)

func (*Namespace) EncodeTranslations

func (r *Namespace) EncodeTranslations() (out locale.ResourceTranslationSet)

func (Namespace) GetLabels

func (m Namespace) GetLabels() map[string]string

GetLabels adds new label to label map

func (Namespace) LabelResourceID

func (m Namespace) LabelResourceID() uint64

GetLabels adds new label to label map

func (Namespace) LabelResourceKind

func (Namespace) LabelResourceKind() string

GetLabels adds new label to label map

func (Namespace) RbacResource

func (r Namespace) RbacResource() string

RbacResource returns string representation of RBAC resource for Namespace by calling NamespaceRbacResource fn

RBAC resource is in the corteza::compose:namespace/... format

This function is auto-generated

func (Namespace) ResourceTranslation

func (r Namespace) ResourceTranslation() string

ResourceTranslation returns string representation of Locale resource for Namespace by calling NamespaceResourceTranslation fn

Locale resource is in "compose:namespace/..." format

This function is auto-generated

func (*Namespace) SetLabel

func (m *Namespace) SetLabel(key string, value string)

SetLabel adds new label to label map

type NamespaceFilter

type NamespaceFilter struct {
	NamespaceID []uint64 `json:"namespaceID"`

	Query string `json:"query"`
	Slug  string `json:"slug"`
	Name  string `json:"name"`

	LabeledIDs []uint64          `json:"-"`
	Labels     map[string]string `json:"labels,omitempty"`

	Deleted filter.State `json:"deleted"`

	// Check fn is called by store backend for each resource found function can
	// modify the resource and return false if store should not return it
	//
	// Store then loads additional resources to satisfy the paging parameters
	Check func(*Namespace) (bool, error) `json:"-"`

	// Standard helpers for paging and sorting
	filter.Sorting
	filter.Paging
}

type NamespaceMeta

type NamespaceMeta struct {
	// Temporary icon & logo URLs
	// @todo rework this when we rework attachment management
	Icon        string `json:"icon,omitempty"`
	IconID      uint64 `json:"iconID,string"`
	LogoID      uint64 `json:"logoID,string"`
	LogoEnabled bool   `json:"logoEnabled,omitempty"`

	// Warning: value of this field is now handled via resource-translation facility
	//          struct field is kept for the convenience for now since it allows us
	//          easy encoding/decoding of the outgoing/incoming values
	Subtitle string `json:"subtitle,omitempty"`

	// Warning: value of this field is now handled via resource-translation facility
	//          struct field is kept for the convenience for now since it allows us
	//          easy encoding/decoding of the outgoing/incoming values
	Description string `json:"description,omitempty"`
}

func (*NamespaceMeta) Scan

func (nm *NamespaceMeta) Scan(value interface{}) error

func (NamespaceMeta) Value

func (nm NamespaceMeta) Value() (driver.Value, error)

type NamespaceSet

type NamespaceSet []*Namespace

NamespaceSet slice of Namespace

This type is auto-generated.

func (NamespaceSet) Filter

func (set NamespaceSet) Filter(f func(*Namespace) (bool, error)) (out NamespaceSet, err error)

Filter iterates through every slice item, calls f(Namespace) (bool, err) and return filtered slice

This function is auto-generated.

func (NamespaceSet) FindByHandle

func (set NamespaceSet) FindByHandle(handle string) *Namespace

FindByHandle finds namespace by it's handle/slug

func (NamespaceSet) FindByID

func (set NamespaceSet) FindByID(ID uint64) *Namespace

FindByID finds items from slice by its ID property

This function is auto-generated.

func (NamespaceSet) IDs

func (set NamespaceSet) IDs() (IDs []uint64)

IDs returns a slice of uint64s from all items in the set

This function is auto-generated.

func (NamespaceSet) Walk

func (set NamespaceSet) Walk(w func(*Namespace) error) (err error)

Walk iterates through every slice item and calls w(Namespace) err

This function is auto-generated.

type OperationType

type OperationType string
const (
	OperationTypeCreate OperationType = "create"
	OperationTypeUpdate OperationType = "update"
	OperationTypeDelete OperationType = "delete"
)

type Page

type Page struct {
	ID     uint64 `json:"pageID,string"`
	SelfID uint64 `json:"selfID,string"`

	NamespaceID uint64 `json:"namespaceID,string"`

	ModuleID uint64 `json:"moduleID,string"`

	Handle string `json:"handle"`

	Config PageConfig `json:"config"`
	Blocks PageBlocks `json:"blocks"`

	Children PageSet `json:"children,omitempty"`

	Labels map[string]string `json:"labels,omitempty"`

	Visible bool `json:"visible"`
	Weight  int  `json:"weight"`

	CreatedAt time.Time  `json:"createdAt,omitempty"`
	UpdatedAt *time.Time `json:"updatedAt,omitempty"`
	DeletedAt *time.Time `json:"deletedAt,omitempty"`

	// Warning: value of this field is now handled via resource-translation facility
	//          struct field is kept for the convenience for now since it allows us
	//          easy encoding/decoding of the outgoing/incoming values
	Title string `json:"title"`

	// Warning: value of this field is now handled via resource-translation facility
	//          struct field is kept for the convenience for now since it allows us
	//          easy encoding/decoding of the outgoing/incoming values
	Description string `json:"description"`
}

func (Page) Clone

func (m Page) Clone() *Page

func (*Page) DecodeTranslations

func (r *Page) DecodeTranslations(tt locale.ResourceTranslationIndex)

func (*Page) EncodeTranslations

func (r *Page) EncodeTranslations() (out locale.ResourceTranslationSet)

func (Page) GetLabels

func (m Page) GetLabels() map[string]string

GetLabels adds new label to label map

func (Page) LabelResourceID

func (m Page) LabelResourceID() uint64

GetLabels adds new label to label map

func (Page) LabelResourceKind

func (Page) LabelResourceKind() string

GetLabels adds new label to label map

func (Page) RbacResource

func (r Page) RbacResource() string

RbacResource returns string representation of RBAC resource for Page by calling PageRbacResource fn

RBAC resource is in the corteza::compose:page/... format

This function is auto-generated

func (Page) ResourceTranslation

func (r Page) ResourceTranslation() string

ResourceTranslation returns string representation of Locale resource for Page by calling PageResourceTranslation fn

Locale resource is in "compose:page/..." format

This function is auto-generated

func (*Page) SetLabel

func (m *Page) SetLabel(key string, value string)

SetLabel adds new label to label map

type PageBlock

type PageBlock struct {
	BlockID uint64 `json:"blockID,string,omitempty"`

	Options map[string]interface{} `json:"options,omitempty"`
	Style   PageBlockStyle         `json:"style,omitempty"`
	Kind    string                 `json:"kind"`
	XYWH    [4]int                 `json:"xywh"` // x,y,w,h

	// Warning: value of this field is now handled via resource-translation facility
	//          struct field is kept for the convenience for now since it allows us
	//          easy encoding/decoding of the outgoing/incoming values
	Title string `json:"title,omitempty"`

	// Warning: value of this field is now handled via resource-translation facility
	//          struct field is kept for the convenience for now since it allows us
	//          easy encoding/decoding of the outgoing/incoming values
	Description string `json:"description,omitempty"`
}

func (*PageBlock) UnmarshalJSON

func (b *PageBlock) UnmarshalJSON(data []byte) (err error)

Helper to extract old encoding to new one

type PageBlockStyle

type PageBlockStyle struct {
	Variants map[string]string `json:"variants,omitempty"`
}

type PageBlocks

type PageBlocks []PageBlock

func (*PageBlocks) Scan

func (bb *PageBlocks) Scan(value interface{}) error

func (PageBlocks) Value

func (bb PageBlocks) Value() (driver.Value, error)

type PageButton

type PageButton struct {
	Label   string `json:"label"`
	Enabled bool   `json:"enabled"`
}

type PageButtonConfig

type PageButtonConfig struct {
	New    PageButton `json:"new"`
	Edit   PageButton `json:"edit"`
	Submit PageButton `json:"submit"`
	Delete PageButton `json:"delete"`
	Clone  PageButton `json:"clone"`
	Back   PageButton `json:"back"`
}

type PageChildrenDeleteStrategy

type PageChildrenDeleteStrategy string
const (
	PageChildrenOnDeleteAbort   PageChildrenDeleteStrategy = "abort"
	PageChildrenOnDeleteForce   PageChildrenDeleteStrategy = "force"
	PageChildrenOnDeleteRebase  PageChildrenDeleteStrategy = "rebase"
	PageChildrenOnDeleteCascade PageChildrenDeleteStrategy = "cascade"
)

type PageConfig

type PageConfig struct {
	// How page is presented in the navigation
	NavItem struct {
		Icon *PageConfigIcon `json:"icon,omitempty"`
	} `json:"navItem"`

	Buttons *PageButtonConfig `json:"buttons,omitempty"`
}

func (*PageConfig) Scan

func (bb *PageConfig) Scan(value interface{}) error

func (PageConfig) Value

func (bb PageConfig) Value() (driver.Value, error)

type PageConfigIcon

type PageConfigIcon struct {
	Type string `json:"type,omitempty"`
	Src  string `json:"src"`

	// Any custom styling that should be applied to the icon
	Style map[string]string `json:"style,omitempty"`
}

type PageFilter

type PageFilter struct {
	NamespaceID uint64 `json:"namespaceID,string"`
	ParentID    uint64 `json:"parentID,string,omitempty"`
	ModuleID    uint64 `json:"moduleID,string,omitempty"`
	Root        bool   `json:"root,omitempty"`
	Handle      string `json:"handle"`
	Title       string `json:"title"`
	Query       string `json:"query"`

	LabeledIDs []uint64          `json:"-"`
	Labels     map[string]string `json:"labels,omitempty"`

	Deleted filter.State `json:"deleted"`

	// Check fn is called by store backend for each resource found function can
	// modify the resource and return false if store should not return it
	//
	// Store then loads additional resources to satisfy the paging parameters
	Check func(*Page) (bool, error) `json:"-"`

	// Standard helpers for paging and sorting
	filter.Sorting
	filter.Paging
}

type PageSet

type PageSet []*Page

PageSet slice of Page

This type is auto-generated.

func (PageSet) Filter

func (set PageSet) Filter(f func(*Page) (bool, error)) (out PageSet, err error)

Filter iterates through every slice item, calls f(Page) (bool, err) and return filtered slice

This function is auto-generated.

func (PageSet) FindByHandle

func (set PageSet) FindByHandle(handle string) *Page

FindByHandle finds page by it's handle

func (PageSet) FindByID

func (set PageSet) FindByID(ID uint64) *Page

FindByID finds items from slice by its ID property

This function is auto-generated.

func (PageSet) FindByParent

func (set PageSet) FindByParent(parentID uint64) (out PageSet)

func (PageSet) IDs

func (set PageSet) IDs() (IDs []uint64)

IDs returns a slice of uint64s from all items in the set

This function is auto-generated.

func (PageSet) RecursiveWalk

func (set PageSet) RecursiveWalk(parent *Page, fn func(c *Page, parent *Page) error) (err error)

RecursiveWalk through all child pages

func (PageSet) Walk

func (set PageSet) Walk(w func(*Page) error) (err error)

Walk iterates through every slice item and calls w(Page) err

This function is auto-generated.

type Record

type Record struct {
	ID       uint64 `json:"recordID,string"`
	ModuleID uint64 `json:"moduleID,string"`

	Values RecordValueSet `json:"values,omitempty"`

	Labels map[string]string `json:"labels,omitempty"`

	NamespaceID uint64 `json:"namespaceID,string"`

	OwnedBy   uint64     `json:"ownedBy,string"`
	CreatedAt time.Time  `json:"createdAt,omitempty"`
	CreatedBy uint64     `json:"createdBy,string" `
	UpdatedAt *time.Time `json:"updatedAt,omitempty"`
	UpdatedBy uint64     `json:"updatedBy,string,omitempty" `
	DeletedAt *time.Time `json:"deletedAt,omitempty"`
	DeletedBy uint64     `json:"deletedBy,string,omitempty" `
	// contains filtered or unexported fields
}

Record is a stored row in the `record` table

func (Record) Clone

func (r Record) Clone() *Record

func (Record) Dict

func (r Record) Dict() map[string]interface{}

func (Record) GetLabels

func (m Record) GetLabels() map[string]string

GetLabels adds new label to label map

func (*Record) GetModule

func (r *Record) GetModule() *Module

func (Record) LabelResourceID

func (m Record) LabelResourceID() uint64

GetLabels adds new label to label map

func (Record) LabelResourceKind

func (Record) LabelResourceKind() string

GetLabels adds new label to label map

func (Record) RbacResource

func (r Record) RbacResource() string

RbacResource returns string representation of RBAC resource for Record by calling RecordRbacResource fn

RBAC resource is in the corteza::compose:record/... format

This function is auto-generated

func (*Record) SetLabel

func (m *Record) SetLabel(key string, value string)

SetLabel adds new label to label map

func (*Record) SetModule

func (r *Record) SetModule(m *Module)

Sets/updates module ptr

Only if not previously set and if matches record specs

func (*Record) UnmarshalJSON

func (r *Record) UnmarshalJSON(data []byte) error

UnmarshalJSON for custom record deserialization

Due to https://github.com/golang/go/issues/21092, we should manually reset the given record value set. If this is skipped there is a chance of data corruption; ie. wrong value is removed/edited

type RecordBulk

type RecordBulk struct {
	RefField string    `json:"refField,omitempty"`
	IDPrefix string    `json:"idPrefix,omitempty"`
	Set      RecordSet `json:"set,omitempty"`
}

type RecordBulkOperation

type RecordBulkOperation struct {
	Record    *Record
	LinkBy    string
	Operation OperationType
	ID        string
}

type RecordBulkSet

type RecordBulkSet []*RecordBulk

func (RecordBulkSet) ToBulkOperations

func (set RecordBulkSet) ToBulkOperations(dftModule uint64, dftNamespace uint64) (oo []*RecordBulkOperation, err error)

ToBulkOperations converts BulkRecordSet to a list of BulkRecordOperations

type RecordFilter

type RecordFilter struct {
	ModuleID    uint64 `json:"moduleID,string"`
	NamespaceID uint64 `json:"namespaceID,string"`
	Query       string `json:"query"`

	LabeledIDs []uint64          `json:"-"`
	Labels     map[string]string `json:"labels,omitempty"`

	Deleted filter.State `json:"deleted"`

	// Check fn is called by store backend for each resource found function can
	// modify the resource and return false if store should not return it
	//
	// Store then loads additional resources to satisfy the paging parameters
	Check func(*Record) (bool, error) `json:"-"`

	// Standard helpers for paging and sorting
	filter.Sorting
	filter.Paging
}

type RecordSet

type RecordSet []*Record

RecordSet slice of Record

This type is auto-generated.

func (RecordSet) Filter

func (set RecordSet) Filter(f func(*Record) (bool, error)) (out RecordSet, err error)

Filter iterates through every slice item, calls f(Record) (bool, err) and return filtered slice

This function is auto-generated.

func (RecordSet) FindByID

func (set RecordSet) FindByID(ID uint64) *Record

FindByID finds items from slice by its ID property

This function is auto-generated.

func (RecordSet) IDs

func (set RecordSet) IDs() (IDs []uint64)

IDs returns a slice of uint64s from all items in the set

This function is auto-generated.

func (RecordSet) UserIDs

func (set RecordSet) UserIDs() (IDs []uint64)

UserIDs returns a slice of user IDs from all items in the set

func (RecordSet) Walk

func (set RecordSet) Walk(w func(*Record) error) (err error)

Walk iterates through every slice item and calls w(Record) err

This function is auto-generated.

type RecordValue

type RecordValue struct {
	RecordID  uint64     `json:"-"`
	Name      string     `json:"name"`
	Value     string     `json:"value,omitempty"`
	Ref       uint64     `json:"-"`
	Place     uint       `json:"-"`
	DeletedAt *time.Time `json:"deletedAt,omitempty"`

	Updated  bool   `json:"-"`
	OldValue string `json:"-"`
}

RecordValue is a stored row in the `record_value` table

func (RecordValue) Cast

func (v RecordValue) Cast(f *ModuleField) (interface{}, error)

func (RecordValue) Clone

func (v RecordValue) Clone() *RecordValue

func (RecordValue) IsDeleted

func (v RecordValue) IsDeleted() bool

func (RecordValue) IsUpdated

func (v RecordValue) IsUpdated() bool

type RecordValueError

type RecordValueError struct {
	Kind    string                 `json:"kind"`
	Message string                 `json:"message"`
	Meta    map[string]interface{} `json:"meta"`
}

type RecordValueErrorSet

type RecordValueErrorSet struct {
	Set []RecordValueError `json:"set"`
}

func IsRecordValueErrorSet

func IsRecordValueErrorSet(err error) *RecordValueErrorSet

IsRecordValueErrorSet tests if given error is RecordValueErrorSet (or it wraps it) and it has errors If not is not (or !IsValid), it return nil!

func (*RecordValueErrorSet) Error

func (v *RecordValueErrorSet) Error() string

func (*RecordValueErrorSet) HasKind

func (v *RecordValueErrorSet) HasKind(kind string) bool

func (*RecordValueErrorSet) IsValid

func (v *RecordValueErrorSet) IsValid() bool

func (RecordValueErrorSet) MarshalJSON

func (v RecordValueErrorSet) MarshalJSON() ([]byte, error)

func (*RecordValueErrorSet) Push

func (v *RecordValueErrorSet) Push(err ...RecordValueError)

func (RecordValueErrorSet) Safe

func (RecordValueErrorSet) Safe() bool

safe to show details of this error

type RecordValueFilter

type RecordValueFilter struct {
	RecordID []uint64
	Deleted  filter.State `json:"deleted"`
	Limit    uint
}

type RecordValueSet

type RecordValueSet []*RecordValue

RecordValueSet slice of RecordValue

This type is auto-generated.

func (RecordValueSet) Clone

func (set RecordValueSet) Clone() (vv RecordValueSet)

func (RecordValueSet) Dict

func (set RecordValueSet) Dict(fields ModuleFieldSet) map[string]interface{}

Returns structured representation of values casted to the appropriate types

func (RecordValueSet) Filter

func (set RecordValueSet) Filter(f func(*RecordValue) (bool, error)) (out RecordValueSet, err error)

Filter iterates through every slice item, calls f(RecordValue) (bool, err) and return filtered slice

This function is auto-generated.

func (RecordValueSet) FilterByName

func (set RecordValueSet) FilterByName(name string) (vv RecordValueSet)

func (RecordValueSet) FilterByRecordID

func (set RecordValueSet) FilterByRecordID(recordID uint64) (vv RecordValueSet)

func (RecordValueSet) Get

func (set RecordValueSet) Get(name string, place uint) *RecordValue

Get value set?

func (RecordValueSet) GetClean

func (set RecordValueSet) GetClean() (out RecordValueSet)

func (RecordValueSet) GetUpdated

func (set RecordValueSet) GetUpdated() (out RecordValueSet)

func (RecordValueSet) Has

func (set RecordValueSet) Has(name string, place uint) bool

Has value set?

func (RecordValueSet) Len

func (set RecordValueSet) Len() int

func (RecordValueSet) Less

func (set RecordValueSet) Less(i, j int) bool

func (RecordValueSet) Merge

func (set RecordValueSet) Merge(mfs ModuleFieldSet, new RecordValueSet, canAccessField func(f *ModuleField) bool) (out RecordValueSet)

Merge merges old value set with new one and expects unchanged values to be in the new set

func (RecordValueSet) Replace

func (set RecordValueSet) Replace(name string, values ...string) (vv RecordValueSet)

Replace existing values, remove extra

func (*RecordValueSet) Scan

func (set *RecordValueSet) Scan(value interface{}) error

func (RecordValueSet) Set

Set updates existing value or creates a new one

func (RecordValueSet) SetRecordID

func (set RecordValueSet) SetRecordID(recordID uint64)

func (RecordValueSet) SetUpdatedFlag

func (set RecordValueSet) SetUpdatedFlag(updated bool)

func (RecordValueSet) String

func (set RecordValueSet) String() (o string)

Simple RVS as string output utility fn that can help with debugging

func (RecordValueSet) Swap

func (set RecordValueSet) Swap(i, j int)

func (RecordValueSet) Value

func (set RecordValueSet) Value() (driver.Value, error)

func (RecordValueSet) Walk

func (set RecordValueSet) Walk(w func(*RecordValue) error) (err error)

Walk iterates through every slice item and calls w(RecordValue) err

This function is auto-generated.

Jump to

Keyboard shortcuts

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