instances

package
v0.0.0-...-be0592b Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2019 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchBizIDFromInstance

func FetchBizIDFromInstance(objID string, instanceData mapstr.MapStr) (int64, error)

func FillLostedFieldValue

func FillLostedFieldValue(valData mapstr.MapStr, propertys []metadata.Attribute, ignorefields []string)

FillLostedFieldValue fill the value in inst map data

func New

func New(dbProxy dal.RDB, dependent OperationDependences, cache *redis.Client) core.InstanceOperation

New create a new instance manager instance

func NewValidator

func NewValidator(ctx core.ContextParams, dependent OperationDependences, objID string, bizID int64) (*validator, error)

Init init

Types

type EnumOption

type EnumOption []EnumVal

EnumOption enum option

func ParseEnumOption

func ParseEnumOption(val interface{}) (EnumOption, error)

ParseEnumOption convert val to []EnumVal

func (EnumOption) GetDefault

func (opt EnumOption) GetDefault() *EnumVal

GetDefault returns EnumOption's default value

type EnumVal

type EnumVal struct {
	ID        string `bson:"id"           json:"id"`
	Name      string `bson:"name"         json:"name"`
	Type      string `bson:"type"         json:"type"`
	IsDefault bool   `bson:"is_default"   json:"is_default"`
}

EnumVal enum option val

type EventHandle

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

EventHandle event data tmp handle

func (*EventHandle) Push

func (eh *EventHandle) Push(ctx core.ContextParams, objType, eventAction string) error

Push push event to event server

func (*EventHandle) SetCurData

func (eh *EventHandle) SetCurData(id int64, data interface{})

SetCurData set inst current data

func (*EventHandle) SetCurDataAndPush

func (eh *EventHandle) SetCurDataAndPush(ctx core.ContextParams, objID, eventAction string, cond mapstr.MapStr) error

SetCurDataAndPush get current instance info and push data

func (*EventHandle) SetPreData

func (eh *EventHandle) SetPreData(id int64, data interface{})

SetPreData set inst befor data

type FloatOption

type FloatOption struct {
	Min string `bson:"min" json:"min"`
	Max string `bson:"max" json:"max"`
}

FloatOption float option

type IntOption

type IntOption struct {
	Min string `bson:"min" json:"min"`
	Max string `bson:"max" json:"max"`
}

IntOption integer option

type OperationDependences

type OperationDependences interface {

	// IsInstanceExist used to check if the  instances  asst exist
	IsInstAsstExist(ctx core.ContextParams, objID string, instID uint64) (exists bool, err error)

	// DeleteInstAsst used to delete inst asst
	DeleteInstAsst(ctx core.ContextParams, objID string, instID uint64) error

	// SelectObjectAttWithParams select object att with params
	SelectObjectAttWithParams(ctx core.ContextParams, objID string, bizID int64) (attribute []metadata.Attribute, err error)

	// SearchUnique search unique attribute
	SearchUnique(ctx core.ContextParams, objID string) (uniqueAttr []metadata.ObjectUnique, err error)
}

OperationDependences methods definition

Jump to

Keyboard shortcuts

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