entity

package
v0.0.0-...-9b5cd94 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("entity is not found")

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	Insert(ctx context.Context, entity types.Entity) error

	Update(ctx context.Context, entity types.Entity) error

	Get(ctx context.Context, id string) (types.Entity, bool)

	GetIDs(ctx context.Context, filter map[string]interface{}, ids *[]interface{}) error

	Count(ctx context.Context) (int, error)

	UpsertMany(ctx context.Context, entities []types.Entity) (map[string]bool, error)

	AddInfos(ctx context.Context, id string, infos map[string]types.Info) (bool, error)

	UpdateComponentInfos(ctx context.Context, id, componentID string) (map[string]types.Info, error)

	UpdateComponentInfosByComponent(ctx context.Context, componentID string) ([]string, error)

	UpdateLastEventDate(ctx context.Context, ids []string, time datetime.CpsTime) error
	UpdateIdleFields(ctx context.Context, id string, idleSince *datetime.CpsTime, lastIdleRuleApply string) error

	FindByIDs(ctx context.Context, ids []string) ([]types.Entity, error)

	GetAllWithLastUpdateDateBefore(ctx context.Context, time datetime.CpsTime, exclude []string) (mongo.Cursor, error)

	GetWithIdleSince(ctx context.Context) (mongo.Cursor, error)

	Bulk(ctx context.Context, models []mongodriver.WriteModel) error

	FindToCheckPbehaviorInfo(ctx context.Context, idsWithPbehaviors []string, exceptIds []string) (mongo.Cursor, error)

	UpdatePbehaviorInfo(ctx context.Context, id string, info types.PbehaviorInfo) error

	FindConnector(ctx context.Context, id string) (*types.Entity, error)
	FindComponent(ctx context.Context, id string) (*types.Entity, error)
}

Adapter ...

func NewAdapter

func NewAdapter(dbClient mongo.DbClient) Adapter

NewAdapter gives the correct entity adapter. Give nil to the redis client and it will create a new redis.Client with the dedicated redis database for entities.

type Service

type Service interface {
	Adapter

	FlushCache() error
}

Service glue Adapter and Cache together

Jump to

Keyboard shortcuts

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