engine

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AUTH_MODE_JWT     AuthMethod = "jwt"
	AUTH_MODE_CERT    AuthMethod = "cert"
	AUTH_MODE_DESKTOP AuthMethod = "desktop"

	ST_ON_PREM ServerType = "on_prem"
	ST_CLOUD   ServerType = "cloud"
)
View Source
const (
	MASTER_OBJECT string = "masterobject"
	STORY         string = "story"
	CONNECTION    string = "connection"
)

Variables

View Source
var (
	GetObjMethods = map[string]string{
		"sheet":     "GetObject",
		"measure":   "GetMeasure",
		"dimension": "GetDimension",
		"variable":  "GetVariableById",
		"bookmark":  "GetBookmark",
	}
	CreateObjMethods = map[string]string{
		"sheet":     "CreateObjectRaw",
		"measure":   "CreateMeasureRaw",
		"dimension": "CreateDimensionRaw",
		"variable":  "CreateVariableExRaw",
		"bookmark":  "CreateBookmarkRaw",
	}
	DestroyObjMethods = map[string]string{
		"sheet":     "DestroyObject",
		"measure":   "DestroyMeasure",
		"dimension": "DestroyDimension",
		"variable":  "DestroyVariableById",
		"bookmark":  "DestroyBookmark",
	}

	SessionObjDef = []byte(`
	{
		"qInfo": {
			"qId": "",
			"qType": "SessionLists"
		},
		"qAppObjectListDef": {
			"qType": "sheet",
			"qData": {
				"id": "/qInfo/qId"
			}
		},
		"qDimensionListDef": {
			"qType": "dimension",
			"qData": {
				"id": "/qInfo/qId"
			}
		},
		"qMeasureListDef": {
			"qType": "measure",
			"qData": {
				"id": "/qInfo/qId"
			}
		},
		"qBookmarkListDef": {
			"qType": "bookmark",
			"qData": {
				"id": "/qInfo/qId"
			}
		},
		"qVariableListDef": {
			"qType": "variable",
			"qData": {
				"id": "/qInfo/qId"
			}
		}
	}
	`)

	SessionDimListDefData = []byte(`
	{
		"title": "/qMetaDef/title",
		"tags": "/qMetaDef/tags",
		"grouping": "/qDim/qGrouping",
		"info": "/qDimInfos",
		"labelExpression": "/qDim/qLabelExpression"
	}`)
)
View Source
var (
	// ConnCtx is used for Engine requests per session/connection;
	ConnCtx context.Context
)
View Source
var (
	PAGE_MAX_CELLS int = 4096
)
View Source
var SessionBookmarkListDef = []byte(`
{
	"qInfo": {
		"qId": "BookmarkList",
		"qType": "BookmarkList"
	},
	"qBookmarkListDef": {
		"qType": "bookmark",
		"qData": {
			"sheetId": "/sheetId",
			"selectionFields": "/selectionFields",
			"creationDate": "/creationDate"
		}
	}
}
`)

Functions

func CreateChild

func CreateChild(doc *enigma.Doc, parentInfo enigma.NxInfo, prop json.RawMessage) (reflect.Value, error)

func CreateObject

func CreateObject(doc *enigma.Doc, qtype string, prop json.RawMessage) (reflect.Value, error)

func DestroyObject

func DestroyObject(doc *enigma.Doc, qtype string, qid string) (reflect.Value, error)

func GetCurrentSelection

func GetCurrentSelection(doc *enigma.Doc, stateName string) (*enigma.SelectionObject, *util.Result)

func GetHyperCubeData

func GetHyperCubeData(obj *enigma.GenericObject, sz enigma.Size) ([]*enigma.NxDataPage, *util.Result)

func GetHyperCubePivotData

func GetHyperCubePivotData(obj *enigma.GenericObject, sz enigma.Size) ([]*enigma.NxPivotPage, *util.Result)

func GetListObject

func GetListObject(doc *enigma.Doc, stateName, fieldName string) (*enigma.ListObject, *util.Result)

func GetObject

func GetObject(doc *enigma.Doc, qtype string, qid string) (reflect.Value, error)

func GetTitle

func GetTitle(parentInfo *enigma.NxInfo, obj *ObjectPropeties, logger *zerolog.Logger) (*string, *string)

return title, description

func GetTitleEx

func GetTitleEx(obj enigma.GenericObject, objLayout ObjectLayoutEx) (*string, *string, *util.Result)

func HasMethodOn

func HasMethodOn(any reflect.Value, name string) bool

func Invoke

func Invoke(any interface{}, name string, args ...interface{}) (Results []reflect.Value, err error)

func Invoke1ErrOn

func Invoke1ErrOn(any reflect.Value, name string, args ...interface{}) error

func Invoke1Res1Err

func Invoke1Res1Err(any interface{}, name string, args ...interface{}) (Result reflect.Value, err error)

func Invoke1Res1ErrOn

func Invoke1Res1ErrOn(any reflect.Value, name string, args ...interface{}) (Result reflect.Value, err error)

func InvokeOn

func InvokeOn(any reflect.Value, name string, args ...interface{}) (Results []reflect.Value, err error)

func Paging

func Paging(rect enigma.Rect) []*enigma.NxPage

func PivotPaging

func PivotPaging(rect enigma.Rect) []*enigma.NxPage

func RecursiveCreateObject

func RecursiveCreateObject(doc *enigma.Doc, prop ObjectPropeties, parent *enigma.NxInfo) (*enigma.GenericObject, *util.Result)

func SetStringVariable

func SetStringVariable(doc *enigma.Doc, name string, value string) error

func SetVariable

func SetVariable(doc *enigma.Doc, name string, value string) error

Types

type AppLayoutMeta

type AppLayoutMeta struct {
	ID                  string                   `json:"id,omitempty"`
	CreatedDate         string                   `json:"createdDate,omitempty"`
	ModifiedDate        string                   `json:"modifiedDate,omitempty"`
	Published           bool                     `json:"published"`
	PublishTime         string                   `json:"publishTime,omitempty"`
	Privileges          []string                 `json:"privileges,omitempty"`
	DynamicColor        string                   `json:"dynamicColor,omitempty"`
	Title               string                   `json:"qTitle,omitempty"`
	FileName            string                   `json:"qFileName,omitempty"`
	LastReloadTime      string                   `json:"qLastReloadTime,omitempty"`
	Modified            bool                     `json:"qModified,omitempty"`
	HasScript           bool                     `json:"qHasScript,omitempty"`
	StateNames          []string                 `json:"qStateNames,omitempty"`
	Meta                *AppMeta                 `json:"qMeta,omitempty"`
	LocaleInfo          *enigma.LocaleInfo       `json:"qLocaleInfo,omitempty"`
	HasData             bool                     `json:"qHasData,omitempty"`
	ReadOnly            bool                     `json:"qReadOnly,omitempty"`
	IsOpenedWithoutData bool                     `json:"qIsOpenedWithoutData,omitempty"`
	IsSessionApp        bool                     `json:"qIsSessionApp,omitempty"`
	Thumbnail           *enigma.StaticContentUrl `json:"qThumbnail,omitempty"`
	IsBDILiveMode       bool                     `json:"qIsBDILiveMode,omitempty"`
	Prop                *enigma.NxAppProperties  `json:"qProp,omitempty"`
}

type AppMeta

type AppMeta struct {
	Name string                  `json:"qName,omitempty"`
	Prop *enigma.NxAppProperties `json:"qProp,omitempty"`
}

type AppObjectList

type AppObjectList struct {
	Items []*NxContainerEntry `json:"qItems,omitempty"`
}

type AuditLogEntry

type AuditLogEntry struct {
	ProductVersion    string            `csv:"ProductVersion"`
	Timestamp         AuditLogTimeStamp `csv:"Timestamp"`
	Hostname          string            `csv:"Hostname"`
	Id                string            `csv:"Id"`
	EngineTimestamp   AuditLogTimeStamp `csv:"EngineTimestamp"`
	EngineVersion     string            `csv:"EngineVersion"`
	Description       string            `csv:"Description"`
	ProxySessionId    string            `csv:"ProxySessionId"`
	ProxyPackageId    string            `csv:"ProxyPackageId"`
	RequestSequenceId string            `csv:"RequestSequenceId"`
	UserDirectory     string            `csv:"UserDirectory"`
	UserId            string            `csv:"UserId"`
	SessionId         string            `csv:"SessionId"`
	ObjectId          string            `csv:"ObjectId"`
	ObjectName        string            `csv:"ObjectName"`
	Service           string            `csv:"Service"`
	Origin            string            `csv:"Origin"`
	Context           string            `csv:"Context"`
	Command           string            `csv:"Command"`
	Result            string            `csv:"Result"`
	Message           string            `csv:"Message"`
	Id2               string            `csv:"Id2"`
}

func ReadAuditLogFile

func ReadAuditLogFile(file string) ([]AuditLogEntry, *util.Result)

type AuditLogTimeStamp

type AuditLogTimeStamp struct {
	time.Time
}

func (*AuditLogTimeStamp) UnmarshalCSV

func (date *AuditLogTimeStamp) UnmarshalCSV(csv string) (err error)

type AuthMethod

type AuthMethod string

type BookmarkEntry

type BookmarkEntry struct {
	Info *enigma.NxInfo  `json:"qInfo,omitempty"`
	Meta *BookmarkMeta   `json:"qMeta,omitempty"`
	Data json.RawMessage `json:"qData,omitempty"`
}

func GetBookmarks

func GetBookmarks(doc *enigma.Doc) ([]*BookmarkEntry, *util.Result)

type BookmarkList

type BookmarkList struct {
	Items []*NxContainerEntry `json:"qItems,omitempty"`
}

type BookmarkMeta

type BookmarkMeta struct {
	Title string `json:"title,omitempty"`
}

type ColumnInfo

type ColumnInfo struct {
	FallbackTitle     string
	ApprMaxGlyphCount int
	NumFormat         *enigma.FieldAttributes
	AttrExprInfo      []*enigma.NxAttrExprInfo
	AttrDimInfo       []*enigma.NxAttrDimInfo
	Error             *enigma.NxValidationError
}

func NewColumnInfoFromDimension

func NewColumnInfoFromDimension(dim *enigma.NxDimensionInfo) *ColumnInfo

func NewColumnInfoFromMeasure

func NewColumnInfoFromMeasure(m *enigma.NxMeasureInfo) *ColumnInfo

type Config

type Config struct {
	EngineURI          string              `json:"engine_uri,omitempty" yaml:"engine_uri,omitempty" bson:"engine_uri,omitempty"`
	AppID              string              `json:"app_id,omitempty" yaml:"app_id,omitempty" bson:"app_id,omitempty"`
	QRSBaseURI         string              `json:"qrs_base_uri,omitempty" yaml:"qrs_base_uri,omitempty" bson:"qrs_base_uri,omitempty"` //if ServerType is ST_CLOUD, this field is base URL of the QCS tenant e.g. https://tenant.eu.qlikcloud.com
	HubURI             *HubUri             `json:"hub_uri,omitempty" yaml:"hub_uri,omitempty" bson:"hub_uri,omitempty"`
	SharedFolderRoot   *string             `json:"shared_folder_root,omitempty" yaml:"shared_folder_root,omitempty" bson:"shared_folder_root,omitempty"` //QSEoK shared folder which contains: `Apps`, `StaticContent` etc.
	UserName           string              `json:"user_id,omitempty" yaml:"user_id,omitempty" bson:"user_name,omitempty"`
	UserDirectory      string              `json:"user_ad,omitempty" yaml:"user_ad,omitempty" bson:"user_directory,omitempty"`
	AuthMode           AuthMethod          `json:"auth_mode,omitempty" yaml:"auth_mode,omitempty" bson:"auth_mode,omitempty"`
	ServerType         ServerType          `json:"server_type,omitempty" yaml:"server_type,omitempty" bson:"server_type,omitempty"`
	JWT                string              `json:"jwt,omitempty" yaml:"jwt,omitempty" bson:"jwt,omitempty"`
	Certs              crypto.Certificates `json:"certs,omitempty" yaml:"certs,omitempty" bson:"certs,omitempty"`
	RandomProxySession bool                `json:"random_proxy_session" yaml:"random_proxy_session" bson:"random_proxy_session"`
}

Config contains connection info used to make wss to Engine.

func (Config) IsCloud

func (cfg Config) IsCloud() bool

func (Config) IsDesktop

func (cfg Config) IsDesktop() bool

func (Config) IsOnPrem

func (cfg Config) IsOnPrem() bool

func (*Config) QCSEngineURIAppendAppID

func (cfg *Config) QCSEngineURIAppendAppID(appid string) *util.Result

type Conn

type Conn struct {
	Global *enigma.Global `json:"-"`
	Cfg    Config         `json:"config"`
}

Conn creates wss connection to Engine

func NewConn

func NewConn(cfg Config) (con *Conn, err error)

NewConn creates a Engine wss according to cfg.

type ContainerChildInfo

type ContainerChildInfo struct {
	ContainerChildId string `json:"containerChildId,omitempty"`
	QExtendsId       string `json:"qExtendsId,omitempty"`
	ShowCondition    string `json:"showCondition,omitempty"`
	Title            string `json:"title,omitempty"`
	Visualization    string `json:"visualization,omitempty"`
}

type ContainerChildItem

type ContainerChildItem struct {
	Entry *enigma.NxContainerEntry
	Info  *ContainerChildInfo
}

type DimensionList

type DimensionList struct {
	Items []*NxContainerEntry `json:"qItems,omitempty"`
}

func GetDimensionList

func GetDimensionList(doc *enigma.Doc) (*DimensionList, *util.Result)

type HubUri

type HubUri struct {
	Host     string `json:"host,omitempty" yaml:"host,omitempty" bson:"host,omitempty"`
	Port     int    `json:"port,omitempty" yaml:"port,omitempty" bson:"port,omitempty"`
	Prefix   string `json:"prefix,omitempty" yaml:"prefix,omitempty" bson:"prefix,omitempty"`
	IsSecure bool   `json:"isSecure,omitempty" yaml:"isSecure,omitempty" bson:"isSecure,omitempty"`
}

type MeasureList

type MeasureList struct {
	// Information about the list of measures.
	Items []*NxContainerEntry `json:"qItems,omitempty"`
}

type NxContainerEntry

type NxContainerEntry struct {
	Info *enigma.NxInfo  `json:"qInfo,omitempty"`
	Meta *NxMeta         `json:"qMeta,omitempty"`
	Data json.RawMessage `json:"qData,omitempty"`
}

func GetObjectList

func GetObjectList(doc *enigma.Doc, ctx context.Context, objType string) ([]*NxContainerEntry, error)

type NxMeta

type NxMeta struct {
	Title        *string  `json:"title,omitempty"`
	Description  *string  `json:"description,omitempty"`
	CreatedDate  *string  `json:"createdDate,omitempty"`
	ModifiedDate *string  `json:"modifiedDate,omitempty"`
	Published    bool     `json:"published,omitempty"`
	PublishTime  *string  `json:"publishTime,omitempty"`
	Privileges   []string `json:"privileges,omitempty"`
	Approved     bool     `json:"approved,omitempty"`
	DynamicColor *string  `json:"dynamicColor,omitempty"`
}

type ObjectChildEx

type ObjectChildEx struct {
	Id       string `json:"cId"`
	IsMaster bool   `json:"isMaster"`
	Label    string `json:"label"`
	RefId    string `json:"refId"`
}

type ObjectLayoutEx

type ObjectLayoutEx struct {
	enigma.GenericObjectLayout
	Children    []*ObjectChildEx    `json:"children"`
	Footnote    string              `json:"footnote"`
	Title       string              `json:"title"`
	Subtitle    string              `json:"subtitle"`
	Totals      *ObjectLayoutTotals `json:"totals,omitempty"`
	ColumnInfos []*ColumnInfo       `json:"-"`
}

func GetObjectLayoutEx

func GetObjectLayoutEx(obj *enigma.GenericObject) (*ObjectLayoutEx, *util.Result)

type ObjectLayoutTotals

type ObjectLayoutTotals struct {
	Label    string `json:"label,omitempty"`
	Position string `json:"position,omitempty"`
	Show     bool   `json:"show,omitempty"`
}

type ObjectPropeties

type ObjectPropeties struct {
	Info       *enigma.NxInfo     `json:"qInfo"`
	Meta       *NxMeta            `json:"qMeta"`
	Properties json.RawMessage    `json:"qProperties"`
	ChildInfos []*ObjectPropeties `json:"qChildInfos"`
}

func GetSheetsObjectProperties

func GetSheetsObjectProperties(doc *enigma.Doc) ([]*ObjectPropeties, *util.Result)

func RecursiveGetProperties

func RecursiveGetProperties(doc *enigma.Doc, entry NxContainerEntry) (*ObjectPropeties, error)

func (*ObjectPropeties) GetChild

func (p *ObjectPropeties) GetChild(id string) (*ObjectPropeties, bool)

type ServerType

type ServerType string

type SessionBookmark

type SessionBookmark struct {
	Info            *enigma.NxInfo     `json:"qInfo,omitempty"`
	Meta            *NxMeta            `json:"qMeta,omitempty"`
	SheetId         string             `json:"sheetId,omitempty"`
	SelectionFields string             `json:"selectionFields,omitempty"`
	Bookmark        *enigma.NxBookmark `json:"qBookmark,omitempty"`
}

func GetSessionBookmarks

func GetSessionBookmarks(doc *enigma.Doc) ([]SessionBookmark, *util.Result)

type SessionObjectLayout

type SessionObjectLayout struct {
	Info           *enigma.NxInfo          `json:"qInfo,omitempty"`
	Meta           *NxMeta                 `json:"qMeta,omitempty"`
	ExtendsId      string                  `json:"qExtendsId,omitempty"`
	HasSoftPatches bool                    `json:"qHasSoftPatches,omitempty"`
	Error          *enigma.NxLayoutErrors  `json:"qError,omitempty"`
	SelectionInfo  *enigma.NxSelectionInfo `json:"qSelectionInfo,omitempty"`
	StateName      string                  `json:"qStateName,omitempty"`

	AppObjectList *AppObjectList `json:"qAppObjectList,omitempty"`
	BookmarkList  *BookmarkList  `json:"qBookmarkList,omitempty"`
	DimensionList *DimensionList `json:"qDimensionList,omitempty"`
	MeasureList   *MeasureList   `json:"qMeasureList,omitempty"`
	VariableList  *VariableList  `json:"qVariableList,omitempty"`

	MediaList          *enigma.MediaList          `json:"qMediaList,omitempty"`
	NxLibraryDimension *enigma.NxLibraryDimension `json:"qNxLibraryDimension,omitempty"`
	NxLibraryMeasure   *enigma.NxLibraryMeasure   `json:"qNxLibraryMeasure,omitempty"`
	SelectionObject    *enigma.SelectionObject    `json:"qSelectionObject,omitempty"`
	StaticContentUrl   *enigma.StaticContentUrl   `json:"qStaticContentUrl,omitempty"`
	TreeData           *enigma.TreeData           `json:"qTreeData,omitempty"`
	UndoInfo           *enigma.UndoInfo           `json:"qUndoInfo,omitempty"`
	ChildList          *enigma.ChildList          `json:"qChildList,omitempty"`
	EmbeddedSnapshot   *enigma.EmbeddedSnapshot   `json:"qEmbeddedSnapshot,omitempty"`
	ExtensionList      *enigma.ExtensionList      `json:"qExtensionList,omitempty"`
	FieldList          *enigma.FieldList          `json:"qFieldList,omitempty"`
	HyperCube          *enigma.HyperCube          `json:"qHyperCube,omitempty"`
	ListObject         *enigma.ListObject         `json:"qListObject,omitempty"`
}

func GetSessionObjectLayout

func GetSessionObjectLayout(doc *enigma.Doc) (*SessionObjectLayout, *util.Result)

type VariableList

type VariableList struct {
	// List of the variables.
	Items []*NxContainerEntry `json:"qItems,omitempty"`
}

Jump to

Keyboard shortcuts

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