repository

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PERIPHERAL_API_BASEURL           = "https://email.illasoft.com/v1/"
	PERIPHERAL_API_GENERATE_SQL_PATH = "generateSQL"
)
View Source
const ACTION_CONFIG_FIELD_PUBLIC = "public"
View Source
const APP_AUTO_MAINLINE_VERSION = -1 // -1 for get mainline version automatically
View Source
const APP_AUTO_RELEASE_VERSION = -2 // -1 for get release version automatically
View Source
const APP_CONFIG_FIELD_PUBLIC = "public"
View Source
const APP_EDIT_VERSION = 0 // the editable version app ID always be 0
View Source
const CUSTOMIZATION_LANGUAGE_EN_US = "en-US"
View Source
const CUSTOMIZATION_LANGUAGE_ZH_CN = "zh-CN"
View Source
const GENERATE_SQL_ACTION_DELETE = 4
View Source
const GENERATE_SQL_ACTION_INSERT = 2
View Source
const GENERATE_SQL_ACTION_SELECT = 1
View Source
const GENERATE_SQL_ACTION_UPDATE = 3
View Source
const GENERATE_SQL_DESCRIPTION_TEMPALTE = "### %s tables, with their properties: #%s #### %s %s"

field is: - database type, like "Postgres SQL" - table fields as: #{table_nbame}({column_a}, {column_b}) - user description, like "A query to list the names of the departments which employed more than 10 employees in the last 3 months" - action: like "INSERT, UPDATE ... "

View Source
const KV_STATE_TYPE_DEPENDENCIES = 2 // DependenciesState
View Source
const KV_STATE_TYPE_DOTTED_LINE_SQUARE = 4 // DottedLineSquareState
View Source
const KV_STATE_TYPE_DRAG_SHADOW = 3 // DragShadowState
View Source
const PENDING_USER_AVATAR = ""
View Source
const PENDING_USER_NICKNAME = "pending"
View Source
const PENDING_USER_PASSWORDDIGEST = "pending"
View Source
const SET_STATE_TYPE_DISPLAY_NAME = 5 // DisplayNameState
View Source
const STATE_TYPE_INVALIED = 0

define StateType

View Source
const TREE_STATE_SUMMIT_ID = 0
View Source
const TREE_STATE_SUMMIT_NAME = "root"
View Source
const TREE_STATE_TYPE_COMPONENTS = 1 // ComponentsState

Variables

Functions

func ResolveDisplayNameByPayload

func ResolveDisplayNameByPayload(data interface{}) (string, error)

Types

type Action

type Action struct {
	ID          int       `gorm:"column:id;type:bigserial;primary_key"`
	UID         uuid.UUID `gorm:"column:uid;type:uuid;not null"`
	TeamID      int       `gorm:"column:team_id;type:bigserial"`
	App         int       `gorm:"column:app_ref_id;type:bigint;not null"`
	Version     int       `gorm:"column:version;type:bigint;not null"`
	Resource    int       `gorm:"column:resource_ref_id;type:bigint;not null"`
	Name        string    `gorm:"column:name;type:varchar;size:255;not null"`
	Type        int       `gorm:"column:type;type:smallint;not null"`
	TriggerMode string    `gorm:"column:trigger_mode;type:varchar;size:16;not null"`
	Transformer db.JSONB  `gorm:"column:transformer;type:jsonb"`
	Template    db.JSONB  `gorm:"column:template;type:jsonb"`
	Config      string    `gorm:"column:config;type:jsonb"`
	CreatedAt   time.Time `gorm:"column:created_at;type:timestamp;not null"`
	CreatedBy   int       `gorm:"column:created_by;type:bigint;not null"`
	UpdatedAt   time.Time `gorm:"column:updated_at;type:timestamp;not null"`
	UpdatedBy   int       `gorm:"column:updated_by;type:bigint;not null"`
}

func (*Action) ExportConfig added in v1.9.0

func (action *Action) ExportConfig() *ActionConfig

func (*Action) InitUpdatedAt added in v1.9.0

func (action *Action) InitUpdatedAt()

func (*Action) IsPublic added in v1.9.0

func (action *Action) IsPublic() bool

func (*Action) SetPrivate added in v1.9.0

func (action *Action) SetPrivate(userID int)

func (*Action) SetPublic added in v1.9.0

func (action *Action) SetPublic(userID int)

func (*Action) UpdateAppConfig added in v1.9.0

func (action *Action) UpdateAppConfig(actionConfig *ActionConfig, userID int)

type ActionConfig added in v1.9.0

type ActionConfig struct {
	Public bool `json:"public"` // switch for public action (which can view by anonymous user)
}

func NewActionConfig added in v1.9.0

func NewActionConfig() *ActionConfig

func NewActionConfigByConfigActionRawRequest added in v1.9.0

func NewActionConfigByConfigActionRawRequest(rawReq map[string]interface{}) (*ActionConfig, error)

func NewActionConfigByConfigAppRawRequest added in v1.9.0

func NewActionConfigByConfigAppRawRequest(rawReq map[string]interface{}) (*ActionConfig, error)

func (*ActionConfig) ExportToJSONString added in v1.9.0

func (ac *ActionConfig) ExportToJSONString() string

func (*ActionConfig) SetPrivate added in v1.9.0

func (ac *ActionConfig) SetPrivate()

func (*ActionConfig) SetPublic added in v1.9.0

func (ac *ActionConfig) SetPublic()

type ActionRepository

type ActionRepository interface {
	Create(action *Action) (int, error)
	Delete(teamID int, actionID int) error
	Update(action *Action) error
	UpdatePublicByTeamIDAndAppIDAndUserID(teamID int, appID int, userID int, actionConfig *ActionConfig) error
	RetrieveActionByIDAndTeamID(actionID int, teamID int) (*Action, error)
	RetrieveAll(teamID int, appID int) ([]*Action, error)
	RetrieveByID(teamID int, actionID int) (*Action, error)
	RetrieveActionsByAppVersion(teamID int, appID int, version int) ([]*Action, error)
	DeleteActionsByApp(teamID int, appID int) error
	CountActionByTeamID(teamID int) (int, error)
}

type ActionRepositoryImpl

type ActionRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewActionRepositoryImpl

func NewActionRepositoryImpl(logger *zap.SugaredLogger, db *gorm.DB) *ActionRepositoryImpl

func (*ActionRepositoryImpl) CountActionByTeamID added in v1.9.0

func (impl *ActionRepositoryImpl) CountActionByTeamID(teamID int) (int, error)

func (*ActionRepositoryImpl) Create

func (impl *ActionRepositoryImpl) Create(action *Action) (int, error)

func (*ActionRepositoryImpl) Delete

func (impl *ActionRepositoryImpl) Delete(teamID int, actionID int) error

func (*ActionRepositoryImpl) DeleteActionsByApp

func (impl *ActionRepositoryImpl) DeleteActionsByApp(teamID int, appID int) error

func (*ActionRepositoryImpl) RetrieveActionByIDAndTeamID added in v1.9.0

func (impl *ActionRepositoryImpl) RetrieveActionByIDAndTeamID(actionID int, teamID int) (*Action, error)

func (*ActionRepositoryImpl) RetrieveActionsByAppVersion

func (impl *ActionRepositoryImpl) RetrieveActionsByAppVersion(teamID int, appID int, version int) ([]*Action, error)

func (*ActionRepositoryImpl) RetrieveAll added in v1.9.0

func (impl *ActionRepositoryImpl) RetrieveAll(teamID int, appID int) ([]*Action, error)

func (*ActionRepositoryImpl) RetrieveByID

func (impl *ActionRepositoryImpl) RetrieveByID(teamID int, actionID int) (*Action, error)

func (*ActionRepositoryImpl) Update

func (impl *ActionRepositoryImpl) Update(action *Action) error

func (*ActionRepositoryImpl) UpdatePublicByTeamIDAndAppIDAndUserID added in v1.9.0

func (impl *ActionRepositoryImpl) UpdatePublicByTeamIDAndAppIDAndUserID(teamID int, appID int, userID int, actionConfig *ActionConfig) error

type App

type App struct {
	ID              int       `json:"id" 				gorm:"column:id;type:bigserial;primary_key;unique"`
	UID             uuid.UUID `json:"uid"   		    gorm:"column:uid;type:uuid;not null"`
	TeamID          int       `json:"teamID" 		    gorm:"column:team_id;type:bigserial"`
	Name            string    `json:"name" 				gorm:"column:name;type:varchar"`
	ReleaseVersion  int       `json:"releaseVersion" 	gorm:"column:release_version;type:bigserial"`
	MainlineVersion int       `json:"mainlineVersion" 	gorm:"column:mainline_version;type:bigserial"`
	Config          string    `json:"config" 	        gorm:"column:config;type:jsonb"`
	CreatedAt       time.Time `json:"created_at" 		gorm:"column:created_at;type:timestamp"`
	CreatedBy       int       `json:"created_by" 		gorm:"column:created_by;type:bigserial"`
	UpdatedAt       time.Time `json:"updated_at" 		gorm:"column:updated_at;type:timestamp"`
	UpdatedBy       int       `json:"updated_by" 		gorm:"column:updated_by;type:bigserial"`
}

func (*App) ExportConfig added in v1.9.0

func (app *App) ExportConfig() *AppConfig

func (*App) ExportUpdatedAt added in v1.9.0

func (app *App) ExportUpdatedAt() time.Time

func (*App) InitUpdatedAt added in v1.9.0

func (app *App) InitUpdatedAt()

func (*App) IsPublic added in v1.9.0

func (app *App) IsPublic() bool

func (*App) SetPrivate added in v1.9.0

func (app *App) SetPrivate(userID int)

func (*App) SetPublic added in v1.9.0

func (app *App) SetPublic(userID int)

func (*App) UpdateAppConfig added in v1.9.0

func (app *App) UpdateAppConfig(appConfig *AppConfig, userID int)

type AppConfig added in v1.9.0

type AppConfig struct {
	Public bool `json:"public"` // switch for public app (which can view by anonymous user)
}

func NewAppConfigByConfigAppRawRequest added in v1.9.0

func NewAppConfigByConfigAppRawRequest(rawReq map[string]interface{}) (*AppConfig, error)

func (*AppConfig) ExportToJSONString added in v1.9.0

func (ac *AppConfig) ExportToJSONString() string

func (*AppConfig) IsPublic added in v1.9.0

func (ac *AppConfig) IsPublic() bool

type AppRepository

type AppRepository interface {
	Create(app *App) (int, error)
	Delete(teamID int, appID int) error
	Update(app *App) error
	UpdateUpdatedAt(app *App) error
	RetrieveAll(teamID int) ([]*App, error)
	RetrieveAppByIDAndTeamID(appID int, teamID int) (*App, error)
	RetrieveAllByUpdatedTime(teamID int) ([]*App, error)
	CountAPPByTeamID(teamID int) (int, error)
	RetrieveAppLastModifiedTime(teamID int) (time.Time, error)
}

type AppRepositoryImpl

type AppRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewAppRepositoryImpl

func NewAppRepositoryImpl(logger *zap.SugaredLogger, db *gorm.DB) *AppRepositoryImpl

func (*AppRepositoryImpl) CountAPPByTeamID added in v1.9.0

func (impl *AppRepositoryImpl) CountAPPByTeamID(teamID int) (int, error)

func (*AppRepositoryImpl) Create

func (impl *AppRepositoryImpl) Create(app *App) (int, error)

func (*AppRepositoryImpl) Delete

func (impl *AppRepositoryImpl) Delete(teamID int, appID int) error

func (*AppRepositoryImpl) RetrieveAll

func (impl *AppRepositoryImpl) RetrieveAll(teamID int) ([]*App, error)

func (*AppRepositoryImpl) RetrieveAllByUpdatedTime

func (impl *AppRepositoryImpl) RetrieveAllByUpdatedTime(teamID int) ([]*App, error)

func (*AppRepositoryImpl) RetrieveAppByIDAndTeamID added in v1.9.0

func (impl *AppRepositoryImpl) RetrieveAppByIDAndTeamID(appID int, teamID int) (*App, error)

func (*AppRepositoryImpl) RetrieveAppLastModifiedTime added in v1.9.0

func (impl *AppRepositoryImpl) RetrieveAppLastModifiedTime(teamID int) (time.Time, error)

func (*AppRepositoryImpl) Update

func (impl *AppRepositoryImpl) Update(app *App) error

func (*AppRepositoryImpl) UpdateUpdatedAt

func (impl *AppRepositoryImpl) UpdateUpdatedAt(app *App) error

type ComponentNode

type ComponentNode struct {
	DisplayName    string                 `json:"displayName"`
	ParentNode     string                 `json:"parentNode"`
	ShowName       string                 `json:"showName"`
	Error          bool                   `json:"error"`
	IsDragging     bool                   `json:"isDragging"`
	ChildrenNode   []*ComponentNode       `json:"childrenNode"`
	Type           string                 `json:"type"`
	ContainerType  string                 `json:"containerType"`
	VerticalResize bool                   `json:"verticalResize"`
	H              float64                `json:"h"`
	W              float64                `json:"w"`
	MinH           float64                `json:"minH"`
	MinW           float64                `json:"minW"`
	UnitW          float64                `json:"unitW"`
	UnitH          float64                `json:"unitH"`
	X              float64                `json:"x"`
	Y              float64                `json:"y"`
	Z              float64                `json:"z"`
	Props          map[string]interface{} `json:"props"`
	PanelConfig    map[string]interface{} `json:"panelConfig"`
}

func BuildComponentTree

func BuildComponentTree(treeState *TreeState, treeStateMap map[int]*TreeState, parentComponentNode *ComponentNode) (*ComponentNode, error)

func ConstructComponentNodeByMap

func ConstructComponentNodeByMap(data interface{}) *ComponentNode

func NewComponentNode

func NewComponentNode() *ComponentNode

func NewComponentNodeFromJSON

func NewComponentNodeFromJSON(cnodebyte []byte) (*ComponentNode, error)

func (*ComponentNode) AppendChildrenNode

func (cnode *ComponentNode) AppendChildrenNode(node *ComponentNode)

func (*ComponentNode) Serialization

func (cnode *ComponentNode) Serialization() ([]byte, error)

func (*ComponentNode) SerializationForDatabase

func (cnode *ComponentNode) SerializationForDatabase() ([]byte, error)

func (*ComponentNode) UpdateParentNode

func (cnode *ComponentNode) UpdateParentNode(parentComponentNode *ComponentNode)

type ComponentStateForUpdate

type ComponentStateForUpdate struct {
	Before interface{} `json:"before"`
	After  interface{} `json:"after"`
}

func ConstructComponentStateForUpdateByPayload

func ConstructComponentStateForUpdateByPayload(data interface{}) (*ComponentStateForUpdate, error)

type CreateActionResponse added in v1.9.0

type CreateActionResponse struct {
	ID string `json:"actionID"`
}

func NewCreateActionResponse added in v1.9.0

func NewCreateActionResponse(id int) *CreateActionResponse

func (*CreateActionResponse) ExportForFeedback added in v1.9.0

func (resp *CreateActionResponse) ExportForFeedback() interface{}

type DeleteActionResponse added in v1.9.0

type DeleteActionResponse struct {
	ID string `json:"actionID"`
}

func NewDeleteActionResponse added in v1.9.0

func NewDeleteActionResponse(id int) *DeleteActionResponse

func (*DeleteActionResponse) ExportForFeedback added in v1.9.0

func (resp *DeleteActionResponse) ExportForFeedback() interface{}

type DeleteAppResponse added in v1.9.0

type DeleteAppResponse struct {
	ID string `json:"appID"`
}

func NewDeleteAppResponse added in v1.9.0

func NewDeleteAppResponse(id int) *DeleteAppResponse

func (*DeleteAppResponse) ExportForFeedback added in v1.9.0

func (resp *DeleteAppResponse) ExportForFeedback() interface{}

type DeleteResourceResponse added in v1.9.0

type DeleteResourceResponse struct {
	ID string `json:"resourceId"`
}

func NewDeleteResourceResponse added in v1.9.0

func NewDeleteResourceResponse(id int) *DeleteResourceResponse

func (*DeleteResourceResponse) ExportForFeedback added in v1.9.0

func (resp *DeleteResourceResponse) ExportForFeedback() interface{}

type DisplayNameState

type DisplayNameState []string

func ResolveDisplayNameStateByPayload

func ResolveDisplayNameStateByPayload(data interface{}) (DisplayNameState, error)

type DisplayNameStateForUpdate

type DisplayNameStateForUpdate struct {
	Before string `json:"before"`
	After  string `json:"after"`
}

func ConstructDisplayNameStateForUpdateByPayload

func ConstructDisplayNameStateForUpdateByPayload(data interface{}) (*DisplayNameStateForUpdate, error)

type GenerateSQLFeedback added in v1.9.0

type GenerateSQLFeedback struct {
	Payload string `json:"payload"`
}

func GenerateSQL added in v1.9.0

type GenerateSQLPeripheralRequest added in v1.9.0

type GenerateSQLPeripheralRequest struct {
	Description   string `json:"description" validate:"required"`
	ValidateToken string `json:"validateToken" validate:"required"`
}

func NewGenerateSQLPeripheralRequest added in v1.9.0

func NewGenerateSQLPeripheralRequest(resourceType string, metaInfo map[string]interface{}, req *GenerateSQLRequest) (*GenerateSQLPeripheralRequest, error)

func (*GenerateSQLPeripheralRequest) Export added in v1.9.0

func (m *GenerateSQLPeripheralRequest) Export() map[string]string

func (*GenerateSQLPeripheralRequest) SetValidateToken added in v1.9.0

func (m *GenerateSQLPeripheralRequest) SetValidateToken(token string)

type GenerateSQLRequest added in v1.9.0

type GenerateSQLRequest struct {
	Description string `json:"description" validate:"required"`
	ResourceID  string `json:"resourceID" validate:"required"`
	Action      int    `json:"action" validate:"required"`
}

func NewGenerateSQLRequest added in v1.9.0

func NewGenerateSQLRequest() *GenerateSQLRequest

func (*GenerateSQLRequest) ExportResourceIDInInt added in v1.9.0

func (req *GenerateSQLRequest) ExportResourceIDInInt() int

func (*GenerateSQLRequest) GetActionInString added in v1.9.0

func (req *GenerateSQLRequest) GetActionInString() string

type KVState

type KVState struct {
	ID        int       `json:"id" 		   gorm:"column:id;type:bigserial"`
	UID       uuid.UUID `json:"uid" 	   gorm:"column:uid;type:uuid;not null"`
	TeamID    int       `json:"teamID"    gorm:"column:team_id;type:bigserial"`
	StateType int       `json:"state_type" gorm:"column:state_type;type:bigint"`
	AppRefID  int       `json:"app_ref_id" gorm:"column:app_ref_id;type:bigint"`
	Version   int       `json:"version"    gorm:"column:version;type:bigint"`
	Key       string    `json:"key" 	   gorm:"column:key;type:text"`
	Value     string    `json:"value" 	   gorm:"column:value;type:jsonb"`
	CreatedAt time.Time `json:"created_at" gorm:"column:created_at;type:timestamp"`
	CreatedBy int       `json:"created_by" gorm:"column:created_by;type:bigint"`
	UpdatedAt time.Time `json:"updated_at" gorm:"column:updated_at;type:timestamp"`
	UpdatedBy int       `json:"updated_by" gorm:"column:updated_by;type:bigint"`
}

type KVStateRepository

type KVStateRepository interface {
	Create(kvstate *KVState) error
	Delete(teamID int, kvstateID int) error
	Update(kvstate *KVState) error
	RetrieveByID(teamID int, kvstateID int) (*KVState, error)
	RetrieveKVStatesByVersion(teamID int, versionID int) ([]*KVState, error)
	RetrieveKVStatesByKey(teamID int, key string) ([]*KVState, error)
	RetrieveKVStatesByApp(teamID int, apprefid int, statetype int, version int) ([]*KVState, error)
	RetrieveEditVersionByAppAndKey(teamID int, apprefid int, statetype int, key string) (*KVState, error)
	RetrieveAllTypeKVStatesByApp(teamID int, apprefid int, version int) ([]*KVState, error)
	DeleteAllTypeKVStatesByApp(teamID int, apprefid int) error
	DeleteAllKVStatesByAppVersionAndType(teamID int, apprefid int, version int, stateType int) error
}

type KVStateRepositoryImpl

type KVStateRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewKVStateRepositoryImpl

func NewKVStateRepositoryImpl(logger *zap.SugaredLogger, db *gorm.DB) *KVStateRepositoryImpl

func (*KVStateRepositoryImpl) Create

func (impl *KVStateRepositoryImpl) Create(kvstate *KVState) error

func (*KVStateRepositoryImpl) Delete

func (impl *KVStateRepositoryImpl) Delete(teamID int, kvstateID int) error

func (*KVStateRepositoryImpl) DeleteAllKVStatesByAppVersionAndType

func (impl *KVStateRepositoryImpl) DeleteAllKVStatesByAppVersionAndType(teamID int, apprefid int, version int, stateType int) error

func (*KVStateRepositoryImpl) DeleteAllTypeKVStatesByApp

func (impl *KVStateRepositoryImpl) DeleteAllTypeKVStatesByApp(teamID int, apprefid int) error

func (*KVStateRepositoryImpl) RetrieveAllTypeKVStatesByApp

func (impl *KVStateRepositoryImpl) RetrieveAllTypeKVStatesByApp(teamID int, apprefid int, version int) ([]*KVState, error)

func (*KVStateRepositoryImpl) RetrieveByID

func (impl *KVStateRepositoryImpl) RetrieveByID(teamID int, kvstateID int) (*KVState, error)

func (*KVStateRepositoryImpl) RetrieveEditVersionByAppAndKey

func (impl *KVStateRepositoryImpl) RetrieveEditVersionByAppAndKey(teamID int, apprefid int, statetype int, key string) (*KVState, error)

func (*KVStateRepositoryImpl) RetrieveKVStatesByApp

func (impl *KVStateRepositoryImpl) RetrieveKVStatesByApp(teamID int, apprefid int, statetype int, version int) ([]*KVState, error)

func (*KVStateRepositoryImpl) RetrieveKVStatesByKey

func (impl *KVStateRepositoryImpl) RetrieveKVStatesByKey(teamID int, key string) ([]*KVState, error)

func (*KVStateRepositoryImpl) RetrieveKVStatesByVersion

func (impl *KVStateRepositoryImpl) RetrieveKVStatesByVersion(teamID int, version int) ([]*KVState, error)

func (*KVStateRepositoryImpl) Update

func (impl *KVStateRepositoryImpl) Update(kvstate *KVState) error

type RawTeam added in v1.9.0

type RawTeam struct {
	ID         string    `json:"id"`
	UID        uuid.UUID `json:"uid"`
	Name       string    `json:"name"`
	Identifier string    `json:"identifier"`
	Icon       string    `json:"icon"`
	Permission string    `json:"permission"` // for team permission config
	CreatedAt  time.Time ``
	UpdatedAt  time.Time ``
}

type RawUser added in v1.9.0

type RawUser struct {
	ID             string    `json:"id" gorm:"column:id;type:bigserial;primary_key;index:users_ukey"`
	UID            uuid.UUID `json:"uid" gorm:"column:uid;type:uuid;not null;index:users_ukey"`
	Nickname       string    `json:"nickname" gorm:"column:nickname;type:varchar;size:15"`
	PasswordDigest string    `json:"passworddigest" gorm:"column:password_digest;type:varchar;size:60;not null"`
	Email          string    `json:"email" gorm:"column:email;type:varchar;size:255;not null"`
	Avatar         string    `json:"avatar" gorm:"column:avatar;type:varchar;size:255;not null"`
	SSOConfig      string    `json:"SSOConfig" gorm:"column:sso_config;type:jsonb"`        // for single sign-on data
	Customization  string    `json:"customization" gorm:"column:customization;type:jsonb"` // for user itself customization config, including: Language, IsSubscribed
	CreatedAt      time.Time `gorm:"column:created_at;type:timestamp"`
	UpdatedAt      time.Time `gorm:"column:updated_at;type:timestamp"`
}

type ReleaseAppResponse added in v1.9.0

type ReleaseAppResponse struct {
	Version int `json:"version"`
}

func NewReleaseAppResponse added in v1.9.0

func NewReleaseAppResponse(version int) *ReleaseAppResponse

func (*ReleaseAppResponse) ExportForFeedback added in v1.9.0

func (resp *ReleaseAppResponse) ExportForFeedback() interface{}

type Resource

type Resource struct {
	ID        int       `gorm:"column:id;type:bigserial;primary_key"`
	UID       uuid.UUID `gorm:"column:uid;type:uuid;not null"`
	TeamID    int       `gorm:"column:team_id;type:bigserial"`
	Name      string    `gorm:"column:name;type:varchar;size:200;not null"`
	Type      int       `gorm:"column:type;type:smallint;not null"`
	Options   db.JSONB  `gorm:"column:options;type:jsonb"`
	CreatedAt time.Time `gorm:"column:created_at;type:timestamp;not null"`
	CreatedBy int       `gorm:"column:created_by;type:bigint;not null"`
	UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;not null"`
	UpdatedBy int       `gorm:"column:updated_by;type:bigint;not null"`
}

func (*Resource) ExportUpdatedAt added in v1.9.0

func (resource *Resource) ExportUpdatedAt() time.Time

type ResourceRepository

type ResourceRepository interface {
	Create(resource *Resource) (int, error)
	Delete(teamID int, resourceID int) error
	Update(resource *Resource) error
	RetrieveByID(teamID int, resourceID int) (*Resource, error)
	RetrieveAll(teamID int) ([]*Resource, error)
	RetrieveAllByUpdatedTime(teamID int) ([]*Resource, error)
	CountResourceByTeamID(teamID int) (int, error)
	RetrieveResourceLastModifiedTime(teamID int) (time.Time, error)
}

type ResourceRepositoryImpl

type ResourceRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewResourceRepositoryImpl

func NewResourceRepositoryImpl(logger *zap.SugaredLogger, db *gorm.DB) *ResourceRepositoryImpl

func (*ResourceRepositoryImpl) CountResourceByTeamID added in v1.9.0

func (impl *ResourceRepositoryImpl) CountResourceByTeamID(teamID int) (int, error)

func (*ResourceRepositoryImpl) Create

func (impl *ResourceRepositoryImpl) Create(resource *Resource) (int, error)

func (*ResourceRepositoryImpl) Delete

func (impl *ResourceRepositoryImpl) Delete(teamID int, resourceID int) error

func (*ResourceRepositoryImpl) RetrieveAll

func (impl *ResourceRepositoryImpl) RetrieveAll(teamID int) ([]*Resource, error)

func (*ResourceRepositoryImpl) RetrieveAllByUpdatedTime

func (impl *ResourceRepositoryImpl) RetrieveAllByUpdatedTime(teamID int) ([]*Resource, error)

func (*ResourceRepositoryImpl) RetrieveByID

func (impl *ResourceRepositoryImpl) RetrieveByID(teamID int, resourceID int) (*Resource, error)

func (*ResourceRepositoryImpl) RetrieveResourceLastModifiedTime added in v1.9.0

func (impl *ResourceRepositoryImpl) RetrieveResourceLastModifiedTime(teamID int) (time.Time, error)

func (*ResourceRepositoryImpl) Update

func (impl *ResourceRepositoryImpl) Update(resource *Resource) error

type Response added in v1.9.0

type Response interface {
	ExportForFeedback() interface{}
}

type SetState

type SetState struct {
	ID        int       `json:"id" 		   gorm:"column:id;type:bigserial"`
	UID       uuid.UUID `json:"uid" 	   gorm:"column:uid;type:uuid;not null"`
	TeamID    int       `json:"teamID"    gorm:"column:team_id;type:bigserial"`
	StateType int       `json:"state_type" gorm:"column:state_type;type:bigint"`
	AppRefID  int       `json:"app_ref_id" gorm:"column:app_ref_id;type:bigint"`
	Version   int       `json:"version"    gorm:"column:version;type:bigint"`
	Value     string    `json:"value" 	   gorm:"column:value;type:text"`
	CreatedAt time.Time `json:"created_at" gorm:"column:created_at;type:timestamp"`
	CreatedBy int       `json:"created_by" gorm:"column:created_by;type:bigint"`
	UpdatedAt time.Time `json:"updated_at" gorm:"column:updated_at;type:timestamp"`
	UpdatedBy int       `json:"updated_by" gorm:"column:updated_by;type:bigint"`
}

type SetStateRepository

type SetStateRepository interface {
	Create(setState *SetState) error
	Delete(teamID int, setStateID int) error
	DeleteByValue(setState *SetState) error
	Update(setState *SetState) error
	UpdateByValue(beforeSetState *SetState, afterSetState *SetState) error
	RetrieveByID(teamID int, setStateID int) (*SetState, error)
	RetrieveSetStatesByVersion(teamID int, version int) ([]*SetState, error)
	RetrieveByValue(setState *SetState) (*SetState, error)
	RetrieveSetStatesByApp(teamID int, apprefid int, statetype int, version int) ([]*SetState, error)
	DeleteAllTypeSetStatesByApp(teamID int, apprefid int) error
}

type SetStateRepositoryImpl

type SetStateRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewSetStateRepositoryImpl

func NewSetStateRepositoryImpl(logger *zap.SugaredLogger, db *gorm.DB) *SetStateRepositoryImpl

func (*SetStateRepositoryImpl) Create

func (impl *SetStateRepositoryImpl) Create(setState *SetState) error

func (*SetStateRepositoryImpl) Delete

func (impl *SetStateRepositoryImpl) Delete(teamID int, setStateID int) error

func (*SetStateRepositoryImpl) DeleteAllTypeSetStatesByApp

func (impl *SetStateRepositoryImpl) DeleteAllTypeSetStatesByApp(teamID int, apprefid int) error

func (*SetStateRepositoryImpl) DeleteByValue

func (impl *SetStateRepositoryImpl) DeleteByValue(setState *SetState) error

func (*SetStateRepositoryImpl) RetrieveByID

func (impl *SetStateRepositoryImpl) RetrieveByID(teamID int, setStateID int) (*SetState, error)

func (*SetStateRepositoryImpl) RetrieveByValue

func (impl *SetStateRepositoryImpl) RetrieveByValue(setState *SetState) (*SetState, error)

func (*SetStateRepositoryImpl) RetrieveSetStatesByApp

func (impl *SetStateRepositoryImpl) RetrieveSetStatesByApp(teamID int, apprefid int, statetype int, version int) ([]*SetState, error)

func (*SetStateRepositoryImpl) RetrieveSetStatesByVersion

func (impl *SetStateRepositoryImpl) RetrieveSetStatesByVersion(teamID int, version int) ([]*SetState, error)

func (*SetStateRepositoryImpl) Update

func (impl *SetStateRepositoryImpl) Update(setState *SetState) error

func (*SetStateRepositoryImpl) UpdateByValue

func (impl *SetStateRepositoryImpl) UpdateByValue(beforeSetState *SetState, afterSetState *SetState) error

type Team added in v1.9.0

type Team struct {
	ID         int       `json:"id"`
	UID        uuid.UUID `json:"uid"`
	Name       string    `json:"name"`
	Identifier string    `json:"identifier"`
	Icon       string    `json:"icon"`
	Permission string    `json:"permission"` // for team permission config
	CreatedAt  time.Time ``
	UpdatedAt  time.Time ``
}

func NewTeam added in v1.9.0

func NewTeam(u *RawTeam) *Team

func NewTeamByDataControlRawData added in v1.9.0

func NewTeamByDataControlRawData(rawTeamString string) (*Team, error)

func (*Team) GetID added in v1.9.0

func (u *Team) GetID() int

type TreeState

type TreeState struct {
	ID                 int       `json:"id" 							 gorm:"column:id;type:bigserial"`
	UID                uuid.UUID `json:"uid" 							 gorm:"column:uid;type:uuid;not null"`
	TeamID             int       `json:"teamID" 						 gorm:"column:team_id;type:bigserial"`
	StateType          int       `json:"state_type" 					 gorm:"column:state_type;type:bigint"`
	ParentNodeRefID    int       `json:"parent_node_ref_id" 			 gorm:"column:parent_node_ref_id;type:bigint"`
	ChildrenNodeRefIDs string    `json:"children_node_ref_ids" 		     gorm:"column:children_node_ref_ids;type:jsonb"`
	AppRefID           int       `json:"app_ref_id" 					 gorm:"column:app_ref_id;type:bigint"`
	Version            int       `json:"version" 					     gorm:"column:version;type:bigint"`
	Name               string    `json:"name" 						     gorm:"column:name;type:text"`
	Content            string    `json:"content"    					 gorm:"column:content;type:jsonb"`
	CreatedAt          time.Time `json:"created_at" 					 gorm:"column:created_at;type:timestamp"`
	CreatedBy          int       `json:"created_by" 					 gorm:"column:created_by;type:bigint"`
	UpdatedAt          time.Time `json:"updated_at" 					 gorm:"column:updated_at;type:timestamp"`
	UpdatedBy          int       `json:"updated_by" 					 gorm:"column:updated_by;type:bigint"`
}

func NewTreeState

func NewTreeState() *TreeState

func (*TreeState) AppendChildrenNodeRefIDs

func (treeState *TreeState) AppendChildrenNodeRefIDs(id int) error

func (*TreeState) ExportChildrenNodeRefIDs

func (treeState *TreeState) ExportChildrenNodeRefIDs() ([]int, error)

func (*TreeState) ExportContentAsComponentState

func (treeState *TreeState) ExportContentAsComponentState() (*ComponentNode, error)

func (*TreeState) RemoveChildrenNodeRefIDs

func (treeState *TreeState) RemoveChildrenNodeRefIDs(id int) error

type TreeStateRepository

type TreeStateRepository interface {
	Create(treestate *TreeState) (int, error)
	Delete(teamID int, treestateID int) error
	Update(treestate *TreeState) error
	RetrieveByID(teamID int, treestateID int) (*TreeState, error)
	RetrieveTreeStatesByVersion(teamID int, versionID int) ([]*TreeState, error)
	RetrieveTreeStatesByName(teamID int, name string) ([]*TreeState, error)
	RetrieveTreeStatesByApp(teamID int, apprefid int, statetype int, version int) ([]*TreeState, error)
	RetrieveEditVersionByAppAndName(teamID int, apprefid int, statetype int, name string) (*TreeState, error)
	RetrieveAllTypeTreeStatesByApp(teamID int, apprefid int, version int) ([]*TreeState, error)
	DeleteAllTypeTreeStatesByApp(teamID int, apprefid int) error
}

type TreeStateRepositoryImpl

type TreeStateRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewTreeStateRepositoryImpl

func NewTreeStateRepositoryImpl(logger *zap.SugaredLogger, db *gorm.DB) *TreeStateRepositoryImpl

func (*TreeStateRepositoryImpl) Create

func (impl *TreeStateRepositoryImpl) Create(treestate *TreeState) (int, error)

func (*TreeStateRepositoryImpl) Delete

func (impl *TreeStateRepositoryImpl) Delete(teamID int, treestateID int) error

func (*TreeStateRepositoryImpl) DeleteAllTypeTreeStatesByApp

func (impl *TreeStateRepositoryImpl) DeleteAllTypeTreeStatesByApp(teamID int, apprefid int) error

func (*TreeStateRepositoryImpl) RetrieveAllTypeTreeStatesByApp

func (impl *TreeStateRepositoryImpl) RetrieveAllTypeTreeStatesByApp(teamID int, apprefid int, version int) ([]*TreeState, error)

func (*TreeStateRepositoryImpl) RetrieveByID

func (impl *TreeStateRepositoryImpl) RetrieveByID(teamID int, treestateID int) (*TreeState, error)

func (*TreeStateRepositoryImpl) RetrieveEditVersionByAppAndName

func (impl *TreeStateRepositoryImpl) RetrieveEditVersionByAppAndName(teamID int, apprefid int, statetype int, name string) (*TreeState, error)

func (*TreeStateRepositoryImpl) RetrieveTreeStatesByApp

func (impl *TreeStateRepositoryImpl) RetrieveTreeStatesByApp(teamID int, apprefid int, statetype int, version int) ([]*TreeState, error)

func (*TreeStateRepositoryImpl) RetrieveTreeStatesByName

func (impl *TreeStateRepositoryImpl) RetrieveTreeStatesByName(teamID int, name string) ([]*TreeState, error)

func (*TreeStateRepositoryImpl) RetrieveTreeStatesByVersion

func (impl *TreeStateRepositoryImpl) RetrieveTreeStatesByVersion(teamID int, version int) ([]*TreeState, error)

func (*TreeStateRepositoryImpl) Update

func (impl *TreeStateRepositoryImpl) Update(treestate *TreeState) error

type User

type User struct {
	ID             int       `json:"id" gorm:"column:id;type:bigserial;primary_key;index:users_ukey"`
	UID            uuid.UUID `json:"uid" gorm:"column:uid;type:uuid;not null;index:users_ukey"`
	Nickname       string    `json:"nickname" gorm:"column:nickname;type:varchar;size:15"`
	PasswordDigest string    `json:"passworddigest" gorm:"column:password_digest;type:varchar;size:60;not null"`
	Email          string    `json:"email" gorm:"column:email;type:varchar;size:255;not null"`
	Avatar         string    `json:"avatar" gorm:"column:avatar;type:varchar;size:255;not null"`
	SSOConfig      string    `json:"SSOConfig" gorm:"column:sso_config;type:jsonb"`        // for single sign-on data
	Customization  string    `json:"customization" gorm:"column:customization;type:jsonb"` // for user itself customization config, including: Language, IsSubscribed
	CreatedAt      time.Time `gorm:"column:created_at;type:timestamp"`
	UpdatedAt      time.Time `gorm:"column:updated_at;type:timestamp"`
}

func NewUser added in v1.9.0

func NewUser(u *RawUser) *User

func NewUserByDataControlRawData added in v1.9.0

func NewUserByDataControlRawData(rawUserString string) (*User, error)

func (*User) ExportIDToString added in v1.9.0

func (u *User) ExportIDToString() string

Jump to

Keyboard shortcuts

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