model

package
v1.1.11-sm-8 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SettingsMetaData

type SettingsMetaData struct {
	Code            string  `json:"code"`
	DisplayName     string  `json:"displayName"`
	Description     string  `json:"description"`
	GroupName       string  `json:"groupName"`
	DisplaySequence int     `json:"displaySequence"`
	Type            string  `json:"type"`
	TypeParam       string  `json:"typeParam"`
	Default         string  `json:"default"`
	Required        bool    `json:"required"`
	Validation      string  `json:"validation"`
	MaxValue        float32 `json:"maxValue"`
	MinValue        float32 `json:"minValue"`
	Hidden          bool    `json:"hidden"`
}

SettingsMetaData contains the metadata regarding settings

func (*SettingsMetaData) ParseAndValidate

func (metadata *SettingsMetaData) ParseAndValidate(value interface{}) (interface{}, error)

ParseAndValidate checks if the supplied value matches the metadata

type TenantSettings

type TenantSettings struct {
	microappModel.Base
	Settings string `gorm:"column:settings;type:text;"`
}

Tenant supports different organisations from the same micro service.

func NewTenant

func NewTenant(context microappCtx.ExecutionContext, tenantID uuid.UUID, metadata []SettingsMetaData) (*TenantSettings, error)

NewTenant creates new instance of Tenant with specified parameters and returns it

func (*TenantSettings) GetSettings

func (tenant *TenantSettings) GetSettings() (map[string]string, error)

GetSettings gets unmarshalled settings for tenant

func (*TenantSettings) GetSettingsMap

func (tenant *TenantSettings) GetSettingsMap() (map[string]string, error)

GetSettingsMap

func (*TenantSettings) GetTenantSettings

func (tenant *TenantSettings) GetTenantSettings(metadatas []SettingsMetaData) error

GetTenantSettings gets the tenant settings with default

func (*TenantSettings) SetTenantSettings

func (tenant *TenantSettings) SetTenantSettings(metadatas []SettingsMetaData, values map[string]interface{}) error

SetTenantSettings updates the tenant settings

func (*TenantSettings) Update

func (tenant *TenantSettings) Update(configuration map[string]interface{}, metadatas []SettingsMetaData) error

Update tenant data

Jump to

Keyboard shortcuts

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