fluid

package module
v0.0.0-...-a6ea77b Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: MIT Imports: 9 Imported by: 1

README

Fluid

Note: This project is still in development, has not even started pre-alpha yet.

Documentation

Index

Constants

View Source
const (
	ContractTypeRequest    = "request"
	ContractTypeResponse   = "response"
	ContractTypeParameters = "parameters"

	ContractFieldTypeFile     = "file"   // only available on request type
	ContractFieldTypeBinary   = "binary" // only available on response type
	ContractFieldTypeString   = "string"
	ContractFieldTypeUuid     = "uuid"
	ContractFieldTypeDate     = "date"
	ContractFieldTypeDateTime = "date-time"
	ContractFieldTypeTime     = "time"
	ContractFieldTypeInteger  = "integer"
	ContractFieldTypeDecimal  = "decimal"
	ContractFieldTypeBoolean  = "boolean"
	ContractFieldTypeMoney    = "money"
)
View Source
const (
	EntityActionMethodGet    = http.MethodGet
	EntityActionMethodPost   = http.MethodPost
	EntityActionMethodPut    = http.MethodPut
	EntityActionMethodDelete = http.MethodDelete

	EntityActionTypeList   = "list"
	EntityActionTypeRecord = "record"

	EntityFieldTypePassword  = "password"
	EntityFieldTypeBinary    = "binary"
	EntityFieldTypeString    = "string"
	EntityFieldTypeUuid      = "uuid"
	EntityFieldTypeDate      = "date"
	EntityFieldTypeDateTime  = "date-time"
	EntityFieldTypeTime      = "time"
	EntityFieldTypeInteger   = "integer"
	EntityFieldTypeDecimal   = "decimal"
	EntityFieldTypeBoolean   = "boolean"
	EntityFieldTypeMoney     = "money"     // money will be stored as an integer to 10^5 precision
	EntityFieldTypeAttribute = "attribute" // attribute denotes an EAV type field
)
View Source
const (
	PortalTypeIonic   = "ionic"
	PortalTypeVuetify = "vuetify"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Contract

type Contract struct {
	Key    string          `json:"key" validate:"required"`
	Name   string          `json:"name" validate:"required"`
	Type   string          `json:"type" validate:"required,contractType"`
	Fields []ContractField `json:"fields" validate:"required,dive"`
}

type ContractField

type ContractField struct {
	Name                       string `json:"name" validate:"required"`
	Description                string `json:"description" validate:"required"`
	Label                      string `json:"label,omitempty"`
	EnableMultipleValueSupport bool   `json:"enableMultipleValueSupport"`
	Type                       string `json:"type" validate:"required,contractFieldType"`
}

type Entity

type Entity struct {
	NameSingular         string         `json:"nameSingular" validate:"required"`
	NamePlural           string         `json:"namePlural" validate:"required"`
	EnableFreeTextSearch bool           `json:"enableFreeTextSearch,omitempty"`
	DisableList          bool           `json:"disableList,omitempty"`
	DisableCreate        bool           `json:"disableCreate,omitempty"`
	DisableUpdate        bool           `json:"disableUpdate,omitempty"`
	DisableDelete        bool           `json:"disableDelete,omitempty"`
	Fields               []EntityField  `json:"fields" validate:"required,dive"`
	Actions              []EntityAction `json:"actions,omitempty" validate:"dive"`
}

type EntityAction

type EntityAction struct {
	Name                            string `json:"name" validate:"required"`
	Description                     string `json:"description" validate:"required"`
	Method                          string `json:"method" validate:"required,entityActionMethod"`
	Type                            string `json:"type" validate:"required,entityActionType"`
	EnableFileDownloadResponse      bool   `json:"enableFileDownloadResponse,omitempty"`
	DisableAuthorizationRequirement bool   `json:"disableAuthorizationRequirement,omitempty"`
	RequestParametersContractKey    string `json:"requestParametersContractKey,omitempty"` // optional and only available if method is GET
	RequestBodyContractKey          string `json:"requestBodyContractKey,omitempty"`       // optional and only available if method is not GET
	ResponseBodyContractKey         string `json:"responseBodyContractKey,omitempty"`      // optional and only available if enableFileDownloadResponse is false
}

type EntityField

type EntityField struct {
	Group                      string              `json:"group,omitempty"`
	Name                       string              `json:"name" validate:"required"`
	Description                string              `json:"description" validate:"required"`
	Label                      string              `json:"label,omitempty"`
	Hint                       string              `json:"hint,omitempty"`             // field hint to display on front end
	EnableMultipleValueSupport bool                `json:"enableMultipleValueSupport"` // [not available for password type]
	Type                       string              `json:"type" validate:"required,entityFieldType"`
	EnableOptionsSupport       bool                `json:"enableOptionsSupport,omitempty"`    // [only available for string, integer type]
	Pattern                    string              `json:"pattern,omitempty"`                 // [not available for password type] regex which is only available for 'string', 'password' types and only if enableOptionsSupport is false (remember to show testing field and help on front-end)
	DefaultValue               string              `json:"defaultValue,omitempty"`            // (validate on screen using enums, pattern, etc.)
	NotHeader                  bool                `json:"notHeader,omitempty"`               // [not available for password type]
	NotSortable                bool                `json:"notSortable,omitempty"`             // [not available for password type] only available if notHeader is false otherwise force to false
	NotFilterable              bool                `json:"notFilterable,omitempty"`           // [not available for password type]
	NotEditable                bool                `json:"notEditable,omitempty"`             // [not available for password type]
	IsOptional                 bool                `json:"isOptional,omitempty"`              // [not available for password type]
	IsProtected                bool                `json:"isProtected,omitempty"`             // [only available for string type] denotes a piece of personal information that must be protected (encryption and audit trail)
	IsEncrypted                bool                `json:"isEncrypted,omitempty"`             // [only available for string type] only available if isProtect is false otherwise force to true
	IsIdentifier               bool                `json:"isIdentifier,omitempty"`            // [only available for string type] only available if isProtect is false otherwise force to true
	Options                    []EntityFieldOption `json:"options,omitempty" validate:"dive"` // [only available for string, integer type]
}

type EntityFieldOption

type EntityFieldOption struct {
	Value interface{} `json:"value" validate:"required,entityFieldOptionValue"` // integer or string based on field type
	Text  string      `json:"text" validate:"required"`                         // human friendly text
}

type MaterialColor

type MaterialColor struct {
	Color    string `json:"color" validate:"required,color"`
	Contrast string `json:"contrast,omitempty" validate:"color"`
	Shade    string `json:"shade,omitempty" validate:"color"`
	Tint     string `json:"tint,omitempty" validate:"color"`
}

type Portal

type Portal struct {
	Name              string   `json:"name" validate:"required"`
	Type              string   `json:"type" validate:"required,portalType"`
	AccountEntityKeys []string `json:"accountEntityKeys"` // list of different account entities that can log into this platform
	LightTheme        Theme    `json:"lightTheme" validate:"required,dive"`
	DarkTheme         Theme    `json:"darkTheme" validate:"required,dive"`
}

type Project

type Project struct {
	Name        string     `json:"name" validate:"required"`
	Description string     `json:"description,omitempty"`
	Version     string     `json:"version" validate:"required"`
	Portals     []Portal   `json:"portals,omitempty" validate:"dive"`
	Entities    []Entity   `json:"entities,omitempty" validate:"dive"`
	Contracts   []Contract `json:"contracts,omitempty" validate:"dive"`
}

func (Project) GenerateOpenApi

func (p Project) GenerateOpenApi() ([]byte, error)

func (Project) Validate

func (p Project) Validate() validator.ValidationErrors

type Theme

type Theme struct {
	Primary   MaterialColor `json:"primary" validate:"required,dive"`
	Secondary MaterialColor `json:"secondary" validate:"required,dive"`
	Tertiary  MaterialColor `json:"tertiary" validate:"required,dive"`
	Success   MaterialColor `json:"success" validate:"required,dive"`
	Warning   MaterialColor `json:"warning" validate:"required,dive"`
	Error     MaterialColor `json:"error" validate:"required,dive"`
	Medium    MaterialColor `json:"medium" validate:"required,dive"`
	Light     MaterialColor `json:"light" validate:"required,dive"`
	Dark      MaterialColor `json:"dark" validate:"required,dive"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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