history

package
v5.0.7 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EvaluateExpressionFacts

func EvaluateExpressionFacts(expressionFacts []situation.ExpressionFact, data map[string]interface{}) map[string]interface{}

func ExtractHistoryDataSearch

func ExtractHistoryDataSearch(historySituations []HistorySituationsV4, historySituationFacts []HistorySituationFactsV4, historyFacts []HistoryFactsV4) search.QueryResult

func ExtractSituationData

func ExtractSituationData(situationID int64, situationInstanceID int64) (situation.Situation, map[string]string, error)

func ReplaceGlobals

func ReplaceGlobals(service HistoryService) func()

ReplaceGlobals affect a new service to the global service singleton

Types

type GetHistorySituationsOptions

type GetHistorySituationsOptions struct {
	SituationID         int64
	SituationInstanceID int64
	ParameterFilters    map[string]string
	FromTS              time.Time
	ToTS                time.Time
}

type HistoryFactsBuilder

type HistoryFactsBuilder struct{}

func (HistoryFactsBuilder) GetHistoryFactLast

func (builder HistoryFactsBuilder) GetHistoryFactLast(situationID int64, instanceID int64, factID int64) sq.SelectBuilder

func (HistoryFactsBuilder) GetHistoryFacts

func (builder HistoryFactsBuilder) GetHistoryFacts(historyFactsIds []int64) sq.SelectBuilder

func (HistoryFactsBuilder) Insert

func (builder HistoryFactsBuilder) Insert(history HistoryFactsV4, resultJSON []byte) sq.InsertBuilder

func (HistoryFactsBuilder) Update

func (builder HistoryFactsBuilder) Update(history HistoryFactsV4) sq.UpdateBuilder

type HistoryFactsQuerier

type HistoryFactsQuerier struct {
	Builder HistoryFactsBuilder
	// contains filtered or unexported fields
}

func (HistoryFactsQuerier) Exec

func (querier HistoryFactsQuerier) Exec(builder sq.InsertBuilder) error

func (HistoryFactsQuerier) Insert

func (querier HistoryFactsQuerier) Insert(history HistoryFactsV4) (int64, error)

func (HistoryFactsQuerier) Query

func (querier HistoryFactsQuerier) Query(builder sq.SelectBuilder) ([]HistoryFactsV4, error)

func (HistoryFactsQuerier) QueryOne

func (querier HistoryFactsQuerier) QueryOne(builder sq.SelectBuilder) (HistoryFactsV4, error)

func (HistoryFactsQuerier) QueryReturning

func (querier HistoryFactsQuerier) QueryReturning(builder sq.InsertBuilder) (int64, error)

type HistoryFactsV4

type HistoryFactsV4 struct {
	ID                  int64
	FactID              int64
	FactName            string
	SituationID         int64
	SituationInstanceID int64
	Ts                  time.Time
	Result              reader.Item
}

type HistoryRecordV4

type HistoryRecordV4 struct {
	SituationID         int64
	SituationInstanceID int64
	Ts                  time.Time
	HistoryFacts        []HistoryFactsV4
	Parameters          map[string]string
	ExpressionFacts     map[string]interface{}
}

HistoryRecordV4 represents a single and unique situation history entry

func (HistoryRecordV4) OverrideParameters

func (hr HistoryRecordV4) OverrideParameters(p map[string]string)

OverrideParameters overrides the parameters of the History Record

type HistoryService

type HistoryService struct {
	HistorySituationsQuerier     HistorySituationsQuerier
	HistorySituationFactsQuerier HistorySituationFactsQuerier
	HistoryFactsQuerier          HistoryFactsQuerier
}

func New

func New(db *sqlx.DB) HistoryService

func S

func S() HistoryService

R is used to access the global service singleton

func (HistoryService) ExtractFactData

func (service HistoryService) ExtractFactData(situationID int64, instanceID int64, historyFactsNew []HistoryFactsV4, existingFactIDs []int64) ([]HistoryFactsV4, map[string]interface{}, error)

Flatten situation data (old and new facts + parameters)

func (HistoryService) GetHistoryFactsFromSituation

func (service HistoryService) GetHistoryFactsFromSituation(historySituations []HistorySituationsV4) ([]HistoryFactsV4, []HistorySituationFactsV4, error)

func (HistoryService) GetHistoryFactsFromSituationIds

func (service HistoryService) GetHistoryFactsFromSituationIds(historySituationsIds []int64) ([]HistoryFactsV4, []HistorySituationFactsV4, error)

func (HistoryService) GetHistorySituationsIdsByCustomInterval

func (service HistoryService) GetHistorySituationsIdsByCustomInterval(options GetHistorySituationsOptions, interval time.Duration, referenceDate time.Time) ([]HistorySituationsV4, error)

func (HistoryService) GetHistorySituationsIdsByStandardInterval

func (service HistoryService) GetHistorySituationsIdsByStandardInterval(options GetHistorySituationsOptions, interval string) ([]HistorySituationsV4, error)

func (HistoryService) GetHistorySituationsIdsLast

func (service HistoryService) GetHistorySituationsIdsLast(options GetHistorySituationsOptions) ([]HistorySituationsV4, error)

type HistorySituationFactsBuilder

type HistorySituationFactsBuilder struct{}

func (HistorySituationFactsBuilder) GetHistorySituationFacts

func (builder HistorySituationFactsBuilder) GetHistorySituationFacts(historySituationsIds []int64) sq.SelectBuilder

func (HistorySituationFactsBuilder) InsertBulk

func (builder HistorySituationFactsBuilder) InsertBulk(historySituationFacts []HistorySituationFactsV4) sq.InsertBuilder

type HistorySituationFactsQuerier

type HistorySituationFactsQuerier struct {
	Builder HistorySituationFactsBuilder
	// contains filtered or unexported fields
}

func (HistorySituationFactsQuerier) Execute

func (querier HistorySituationFactsQuerier) Execute(builder sq.InsertBuilder) error

func (HistorySituationFactsQuerier) Query

type HistorySituationFactsV4

type HistorySituationFactsV4 struct {
	HistorySituationID int64
	HistoryFactID      int64
	FactID             int64
}

type HistorySituationsBuilder

type HistorySituationsBuilder struct{}

func (HistorySituationsBuilder) GetHistorySituationsDetails

func (builder HistorySituationsBuilder) GetHistorySituationsDetails(subQueryIds string, subQueryIdsArgs []interface{}) sq.SelectBuilder

func (HistorySituationsBuilder) GetHistorySituationsIdsBase

func (builder HistorySituationsBuilder) GetHistorySituationsIdsBase(options GetHistorySituationsOptions) sq.SelectBuilder

func (HistorySituationsBuilder) GetHistorySituationsIdsByCustomInterval

func (builder HistorySituationsBuilder) GetHistorySituationsIdsByCustomInterval(options GetHistorySituationsOptions, interval time.Duration, referenceDate time.Time) sq.SelectBuilder

func (HistorySituationsBuilder) GetHistorySituationsIdsByStandardInterval

func (builder HistorySituationsBuilder) GetHistorySituationsIdsByStandardInterval(options GetHistorySituationsOptions, interval string) sq.SelectBuilder

func (HistorySituationsBuilder) GetHistorySituationsIdsLast

func (builder HistorySituationsBuilder) GetHistorySituationsIdsLast(options GetHistorySituationsOptions) sq.SelectBuilder

func (HistorySituationsBuilder) Insert

func (builder HistorySituationsBuilder) Insert(history HistorySituationsV4, parametersJSON []byte, expressionFactsJSON []byte, metadatasJSON []byte) sq.InsertBuilder

type HistorySituationsQuerier

type HistorySituationsQuerier struct {
	Builder HistorySituationsBuilder
	// contains filtered or unexported fields
}

func (HistorySituationsQuerier) Insert

func (querier HistorySituationsQuerier) Insert(history HistorySituationsV4) (int64, error)

func (HistorySituationsQuerier) Query

func (HistorySituationsQuerier) QueryIDs

func (querier HistorySituationsQuerier) QueryIDs(builder sq.SelectBuilder) ([]int64, error)

func (HistorySituationsQuerier) QueryReturning

func (querier HistorySituationsQuerier) QueryReturning(builder sq.InsertBuilder) (int64, error)

type HistorySituationsV4

type HistorySituationsV4 struct {
	ID                    int64
	SituationID           int64
	SituationName         string
	SituationInstanceID   int64
	SituationInstanceName string
	Ts                    time.Time
	Parameters            map[string]string
	ExpressionFacts       map[string]interface{}
	Metadatas             []models.MetaData
}

Jump to

Keyboard shortcuts

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