Documentation ¶
Index ¶
- Constants
- func EvaluateExpressionFacts(expressionFacts []situation.ExpressionFact, data map[string]interface{}) map[string]interface{}
- func ExtractHistoryDataSearch(historySituations []HistorySituationsV4, ...) search.QueryResult
- func ExtractSituationData(situationID int64, situationInstanceID int64) (situation.Situation, map[string]string, error)
- func ReplaceGlobals(service HistoryService) func()
- type FactResult
- type GetFactHistory
- type GetHistorySituationsOptions
- type HistoryFactsBuilder
- func (builder HistoryFactsBuilder) Delete(ID int64) sq.DeleteBuilder
- func (builder HistoryFactsBuilder) DeleteOrphans() sq.DeleteBuilder
- func (builder HistoryFactsBuilder) GetFactResultByDate(param ParamGetFactHistoryByDate) sq.SelectBuilder
- func (builder HistoryFactsBuilder) GetHistoryFactLast(situationID int64, instanceID int64, factID int64) sq.SelectBuilder
- func (builder HistoryFactsBuilder) GetHistoryFacts(historyFactsIds []int64) sq.SelectBuilder
- func (builder HistoryFactsBuilder) GetTodaysFactResultByParameters(param ParamGetFactHistory) sq.SelectBuilder
- func (builder HistoryFactsBuilder) Insert(history HistoryFactsV4, resultJSON []byte) sq.InsertBuilder
- func (builder HistoryFactsBuilder) Update(id int64, resultJSON []byte) sq.UpdateBuilder
- type HistoryFactsQuerier
- func (querier HistoryFactsQuerier) Delete(ID int64) error
- func (querier HistoryFactsQuerier) Exec(builder sq.InsertBuilder) error
- func (querier HistoryFactsQuerier) ExecDelete(builder sq.DeleteBuilder) error
- func (querier HistoryFactsQuerier) ExecUpdate(builder sq.UpdateBuilder) error
- func (querier HistoryFactsQuerier) GetFactResultByDate(param ParamGetFactHistoryByDate) (GetFactHistory, error)
- func (querier HistoryFactsQuerier) GetTodaysFactResultByParameters(param ParamGetFactHistory) (GetFactHistory, error)
- func (querier HistoryFactsQuerier) Insert(history HistoryFactsV4) (int64, error)
- func (querier HistoryFactsQuerier) Query(builder sq.SelectBuilder) ([]HistoryFactsV4, error)
- func (querier *HistoryFactsQuerier) QueryGetSpecificFields(builder sq.SelectBuilder, formatTime string) (GetFactHistory, error)
- func (querier HistoryFactsQuerier) QueryOne(builder sq.SelectBuilder) (HistoryFactsV4, error)
- func (querier HistoryFactsQuerier) QueryReturning(builder sq.InsertBuilder) (int64, error)
- func (querier HistoryFactsQuerier) Update(history HistoryFactsV4) error
- type HistoryFactsV4
- type HistoryRecordV4
- type HistoryService
- func (service HistoryService) CompactHistory(options GetHistorySituationsOptions, interval string) error
- func (service HistoryService) ExtractFactData(situationID int64, instanceID int64, historyFactsNew []HistoryFactsV4, ...) ([]HistoryFactsV4, map[string]interface{}, error)
- func (service HistoryService) GetHistoryFactsFromSituation(historySituations []HistorySituationsV4) ([]HistoryFactsV4, []HistorySituationFactsV4, error)
- func (service HistoryService) GetHistoryFactsFromSituationIds(historySituationsIds []int64) ([]HistoryFactsV4, []HistorySituationFactsV4, error)
- func (service HistoryService) GetHistorySituationsIdsByCustomInterval(options GetHistorySituationsOptions, interval time.Duration, ...) ([]HistorySituationsV4, error)
- func (service HistoryService) GetHistorySituationsIdsByStandardInterval(options GetHistorySituationsOptions, interval string) ([]HistorySituationsV4, error)
- func (service HistoryService) GetHistorySituationsIdsLast(options GetHistorySituationsOptions) ([]HistorySituationsV4, error)
- func (service HistoryService) PurgeHistory(options GetHistorySituationsOptions) error
- type HistorySituationFactsBuilder
- func (builder HistorySituationFactsBuilder) DeleteHistoryFrom(situationHistoryQueryBuilder sq.SelectBuilder) sq.DeleteBuilder
- func (builder HistorySituationFactsBuilder) GetHistorySituationFacts(historySituationsIds []int64) sq.SelectBuilder
- func (builder HistorySituationFactsBuilder) InsertBulk(historySituationFacts []HistorySituationFactsV4) sq.InsertBuilder
- type HistorySituationFactsQuerier
- type HistorySituationFactsV4
- type HistorySituationsBuilder
- func (builder HistorySituationsBuilder) DeleteOrphans() sq.DeleteBuilder
- func (builder HistorySituationsBuilder) GetHistorySituationsDetails(subQueryIds string, subQueryIdsArgs []interface{}) sq.SelectBuilder
- func (builder HistorySituationsBuilder) GetHistorySituationsIdsBase(options GetHistorySituationsOptions) sq.SelectBuilder
- func (builder HistorySituationsBuilder) GetHistorySituationsIdsByCustomInterval(options GetHistorySituationsOptions, interval time.Duration, ...) sq.SelectBuilder
- func (builder HistorySituationsBuilder) GetHistorySituationsIdsByStandardInterval(options GetHistorySituationsOptions, interval string) sq.SelectBuilder
- func (builder HistorySituationsBuilder) GetHistorySituationsIdsLast(options GetHistorySituationsOptions) sq.SelectBuilder
- func (builder HistorySituationsBuilder) GetLatestHistorySituation(situationID int64, situationInstanceID int64) sq.SelectBuilder
- func (builder HistorySituationsBuilder) Insert(history HistorySituationsV4, parametersJSON []byte, expressionFactsJSON []byte, ...) sq.InsertBuilder
- func (builder HistorySituationsBuilder) Update(id int64, parametersJSON []byte, expressionFactsJSON []byte, ...) sq.UpdateBuilder
- type HistorySituationsQuerier
- func (querier HistorySituationsQuerier) ExecDelete(builder sq.DeleteBuilder) error
- func (querier HistorySituationsQuerier) ExecUpdate(builder sq.UpdateBuilder) error
- func (querier HistorySituationsQuerier) GetLatestHistory(situationID int64, situationInstanceID int64) (HistorySituationsV4, error)
- func (querier HistorySituationsQuerier) Insert(history HistorySituationsV4) (int64, error)
- func (querier HistorySituationsQuerier) Query(builder sq.SelectBuilder) ([]HistorySituationsV4, error)
- func (querier *HistorySituationsQuerier) QueryGetFieldsTsMetadatas(ctx context.Context, builder sq.SelectBuilder) (HistorySituationsV4, error)
- func (querier HistorySituationsQuerier) QueryIDs(builder sq.SelectBuilder) ([]int64, error)
- func (querier HistorySituationsQuerier) QueryReturning(builder sq.InsertBuilder) (int64, error)
- func (querier HistorySituationsQuerier) Update(history HistorySituationsV4) error
- type HistorySituationsV4
- type ParamGetFactHistory
- type ParamGetFactHistoryByDate
Constants ¶
View Source
const ( FormatHourMinute = "15:04" // FormatHeureMinute specifies the format for hour and minutes FormatDateHourMinute = "2006-01-02 15:04" // FormatDateHeureMinuteSeconde specifies the format for date, hour, minutes, and seconds )
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 ReplaceGlobals ¶
func ReplaceGlobals(service HistoryService) func()
ReplaceGlobals affect a new service to the global service singleton.
Types ¶
type FactResult ¶ added in v5.3.0
type GetFactHistory ¶ added in v5.3.0
type GetFactHistory struct {
Results []FactResult `json:"results"`
}
type HistoryFactsBuilder ¶
type HistoryFactsBuilder struct{}
func (HistoryFactsBuilder) Delete ¶ added in v5.3.0
func (builder HistoryFactsBuilder) Delete(ID int64) sq.DeleteBuilder
func (HistoryFactsBuilder) DeleteOrphans ¶ added in v5.2.2
func (builder HistoryFactsBuilder) DeleteOrphans() sq.DeleteBuilder
func (HistoryFactsBuilder) GetFactResultByDate ¶ added in v5.3.6
func (builder HistoryFactsBuilder) GetFactResultByDate(param ParamGetFactHistoryByDate) sq.SelectBuilder
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) GetTodaysFactResultByParameters ¶ added in v5.3.0
func (builder HistoryFactsBuilder) GetTodaysFactResultByParameters(param ParamGetFactHistory) sq.SelectBuilder
func (HistoryFactsBuilder) Insert ¶
func (builder HistoryFactsBuilder) Insert(history HistoryFactsV4, resultJSON []byte) sq.InsertBuilder
func (HistoryFactsBuilder) Update ¶
func (builder HistoryFactsBuilder) Update(id int64, resultJSON []byte) sq.UpdateBuilder
type HistoryFactsQuerier ¶
type HistoryFactsQuerier struct { Builder HistoryFactsBuilder // contains filtered or unexported fields }
func (HistoryFactsQuerier) Delete ¶ added in v5.3.0
func (querier HistoryFactsQuerier) Delete(ID int64) error
func (HistoryFactsQuerier) Exec ¶
func (querier HistoryFactsQuerier) Exec(builder sq.InsertBuilder) error
func (HistoryFactsQuerier) ExecDelete ¶ added in v5.2.2
func (querier HistoryFactsQuerier) ExecDelete(builder sq.DeleteBuilder) error
func (HistoryFactsQuerier) ExecUpdate ¶ added in v5.0.13
func (querier HistoryFactsQuerier) ExecUpdate(builder sq.UpdateBuilder) error
func (HistoryFactsQuerier) GetFactResultByDate ¶ added in v5.3.6
func (querier HistoryFactsQuerier) GetFactResultByDate(param ParamGetFactHistoryByDate) (GetFactHistory, error)
func (HistoryFactsQuerier) GetTodaysFactResultByParameters ¶ added in v5.3.0
func (querier HistoryFactsQuerier) GetTodaysFactResultByParameters(param ParamGetFactHistory) (GetFactHistory, 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) QueryGetSpecificFields ¶ added in v5.3.0
func (querier *HistoryFactsQuerier) QueryGetSpecificFields(builder sq.SelectBuilder, formatTime string) (GetFactHistory, 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)
func (HistoryFactsQuerier) Update ¶ added in v5.0.13
func (querier HistoryFactsQuerier) Update(history HistoryFactsV4) error
type HistoryFactsV4 ¶
type HistoryRecordV4 ¶
type HistoryRecordV4 struct { SituationID int64 SituationInstanceID int64 Ts time.Time HistoryFacts []HistoryFactsV4 Parameters map[string]string ExpressionFacts map[string]interface{} EnableDependsOn bool DependsOnParameters map[string]string }
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 (HistoryService) CompactHistory ¶ added in v5.2.3
func (service HistoryService) CompactHistory(options GetHistorySituationsOptions, interval string) error
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)
func (HistoryService) PurgeHistory ¶ added in v5.2.2
func (service HistoryService) PurgeHistory(options GetHistorySituationsOptions) error
type HistorySituationFactsBuilder ¶
type HistorySituationFactsBuilder struct{}
func (HistorySituationFactsBuilder) DeleteHistoryFrom ¶ added in v5.2.2
func (builder HistorySituationFactsBuilder) DeleteHistoryFrom(situationHistoryQueryBuilder sq.SelectBuilder) sq.DeleteBuilder
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) ExecDelete ¶ added in v5.2.2
func (querier HistorySituationFactsQuerier) ExecDelete(builder sq.DeleteBuilder) error
func (HistorySituationFactsQuerier) Execute ¶
func (querier HistorySituationFactsQuerier) Execute(builder sq.InsertBuilder) error
func (HistorySituationFactsQuerier) Query ¶
func (querier HistorySituationFactsQuerier) Query(builder sq.SelectBuilder) ([]HistorySituationFactsV4, error)
type HistorySituationFactsV4 ¶
type HistorySituationsBuilder ¶
type HistorySituationsBuilder struct{}
func (HistorySituationsBuilder) DeleteOrphans ¶ added in v5.2.2
func (builder HistorySituationsBuilder) DeleteOrphans() sq.DeleteBuilder
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) GetLatestHistorySituation ¶ added in v5.3.4
func (builder HistorySituationsBuilder) GetLatestHistorySituation(situationID int64, situationInstanceID int64) sq.SelectBuilder
func (HistorySituationsBuilder) Insert ¶
func (builder HistorySituationsBuilder) Insert(history HistorySituationsV4, parametersJSON []byte, expressionFactsJSON []byte, metadatasJSON []byte) sq.InsertBuilder
func (HistorySituationsBuilder) Update ¶ added in v5.0.13
func (builder HistorySituationsBuilder) Update(id int64, parametersJSON []byte, expressionFactsJSON []byte, metadatasJSON []byte) sq.UpdateBuilder
type HistorySituationsQuerier ¶
type HistorySituationsQuerier struct { Builder HistorySituationsBuilder // contains filtered or unexported fields }
func (HistorySituationsQuerier) ExecDelete ¶ added in v5.2.2
func (querier HistorySituationsQuerier) ExecDelete(builder sq.DeleteBuilder) error
func (HistorySituationsQuerier) ExecUpdate ¶ added in v5.0.13
func (querier HistorySituationsQuerier) ExecUpdate(builder sq.UpdateBuilder) error
func (HistorySituationsQuerier) GetLatestHistory ¶ added in v5.3.4
func (querier HistorySituationsQuerier) GetLatestHistory(situationID int64, situationInstanceID int64) (HistorySituationsV4, error)
func (HistorySituationsQuerier) Insert ¶
func (querier HistorySituationsQuerier) Insert(history HistorySituationsV4) (int64, error)
func (HistorySituationsQuerier) Query ¶
func (querier HistorySituationsQuerier) Query(builder sq.SelectBuilder) ([]HistorySituationsV4, error)
func (*HistorySituationsQuerier) QueryGetFieldsTsMetadatas ¶ added in v5.3.4
func (querier *HistorySituationsQuerier) QueryGetFieldsTsMetadatas(ctx context.Context, builder sq.SelectBuilder) (HistorySituationsV4, error)
func (HistorySituationsQuerier) QueryIDs ¶
func (querier HistorySituationsQuerier) QueryIDs(builder sq.SelectBuilder) ([]int64, error)
func (HistorySituationsQuerier) QueryReturning ¶
func (querier HistorySituationsQuerier) QueryReturning(builder sq.InsertBuilder) (int64, error)
func (HistorySituationsQuerier) Update ¶ added in v5.0.13
func (querier HistorySituationsQuerier) Update(history HistorySituationsV4) error
type HistorySituationsV4 ¶
type ParamGetFactHistory ¶ added in v5.3.0
type ParamGetFactHistory struct { FactID int64 `json:"factID"` SituationID int64 `json:"situationId"` SituationInstanceID int64 `json:"situationInstanceId"` }
func (ParamGetFactHistory) IsValid ¶ added in v5.3.0
func (param ParamGetFactHistory) IsValid() error
type ParamGetFactHistoryByDate ¶ added in v5.3.6
type ParamGetFactHistoryByDate struct { ParamGetFactHistory StartDate string `json:"startDate"` // Expected format: "2006-01-02 15:04:05" EndDate string `json:"endDate"` // Expected format: "2006-01-02 15:04:05" }
func (ParamGetFactHistoryByDate) IsValid ¶ added in v5.3.6
func (p ParamGetFactHistoryByDate) IsValid() error
Click to show internal directories.
Click to hide internal directories.