projections

package
v0.45.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2025 License: MIT Imports: 10 Imported by: 0

README

projections

Client implementation in go for the Freym service projections.

Docs

Please have a look at our documentation.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthData

type AuthData struct {
	TenantId string
	UserId   string
	Scopes   []string
	Data     map[string]any
}

type Data

type Data map[string]any

type DataList

type DataList struct {
	Limit int64
	Page  int64
	Total int64
	Data  []Data
}

type DeliveryClient

type DeliveryClient interface {
	GetData(
		ctx context.Context,
		projection string,
		authData *AuthData,
		id string,
		filter *Filter,
		wait *Wait,
		options *GetSingleEntryOptions,
	) (*Data, error)
	GetJsonData(
		ctx context.Context,
		projection string,
		authData *AuthData,
		id string,
		filter *JsonFilter,
		wait *JsonWait,
		options *GetSingleEntryOptions,
	) (*JsonData, error)
	GetViewData(
		ctx context.Context,
		view string,
		authData *AuthData,
		filter *Filter,
		wait *Wait,
		options *GetEntryOptions,
	) (*Data, error)
	GetViewJsonData(
		ctx context.Context,
		view string,
		authData *AuthData,
		filter *JsonFilter,
		wait *JsonWait,
		options *GetEntryOptions,
	) (*JsonData, error)
	GetDataList(
		ctx context.Context,
		projection string,
		authData *AuthData,
		pagination *Pagination,
		filter *Filter,
		order []Order,
		wait *ListWait,
		options *GetEntryOptions,
	) (*DataList, error)
	GetJsonDataList(
		ctx context.Context,
		projection string,
		authData *AuthData,
		pagination *Pagination,
		filter *JsonFilter,
		order []Order,
		wait *ListWait,
		options *GetEntryOptions,
	) (*JsonDataList, error)
	GetViewDataList(
		ctx context.Context,
		view string,
		authData *AuthData,
		pagination *Pagination,
		filter *Filter,
		order []Order,
		wait *ListWait,
		options *GetEntryOptions,
	) (*DataList, error)
	GetViewJsonDataList(
		ctx context.Context,
		view string,
		authData *AuthData,
		pagination *Pagination,
		filter *JsonFilter,
		order []Order,
		wait *ListWait,
		options *GetEntryOptions,
	) (*JsonDataList, error)
	UpsertData(
		ctx context.Context,
		projection string,
		authData *AuthData,
		id string,
		payload Data,
		eventMetadata *EventMetadata,
	) (*UpsertResponse, error)
	UpsertJsonData(
		ctx context.Context,
		projection string,
		authData *AuthData,
		id string,
		payload JsonData,
		eventMetadata *EventMetadata,
	) (*JsonUpsertResponse, error)
	DeleteDataById(
		ctx context.Context,
		projection string,
		authData *AuthData,
		id string,
		eventMetadata *EventMetadata,
	) (int64, error)
	DeleteDataByFilter(
		ctx context.Context,
		projection string,
		authData *AuthData,
		filter *Filter,
		eventMetadata *EventMetadata,
	) (int64, error)
	DeleteDataByJsonFilter(
		ctx context.Context,
		projection string,
		authData *AuthData,
		filter *JsonFilter,
		eventMetadata *EventMetadata,
	) (int64, error)
	Close() error
}

func NewDeliveryClient

func NewDeliveryClient(
	conf *config.Config,
) (DeliveryClient, error)

type DeploymentOptions

type DeploymentOptions struct {
	Target managementpb.DeploymentTarget
	Force  bool
}

type EnumType

type EnumType struct {
	Name   string
	Values []string
}

type EventMetadata

type EventMetadata struct {
	CorrelationId string
	CausationId   string
	Target        deliverypb.DeploymentTarget
}

type FieldFilter

type FieldFilter struct {
	Operation string
	Type      string
	Value     any
}

type FieldJsonFilter added in v0.33.0

type FieldJsonFilter struct {
	Operation string
	Type      string
	Value     string
}

type Filter

type Filter struct {
	// all these field filters have to match
	Fields map[string]FieldFilter
	// these filters will be calculated using the and operator
	And []Filter
	// these filters will be calculated using the or operator
	Or []Filter
}

type GetEntryOptions added in v0.45.0

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

func (*GetEntryOptions) Target added in v0.45.0

func (*GetEntryOptions) UseStrongConsistency added in v0.45.0

func (o *GetEntryOptions) UseStrongConsistency() bool

func (*GetEntryOptions) UseStrongConsistencyById added in v0.45.0

func (o *GetEntryOptions) UseStrongConsistencyById() string

type GetEntryOptionsBuilder added in v0.45.0

type GetEntryOptionsBuilder struct {
	Target                   deliverypb.DeploymentTarget
	UseStrongConsistency     bool
	UseStrongConsistencyById string
}

func (*GetEntryOptionsBuilder) Build added in v0.45.0

type GetSingleEntryOptions added in v0.45.0

type GetSingleEntryOptions struct {
	GetEntryOptions
	// contains filtered or unexported fields
}

func (*GetSingleEntryOptions) ReturnEmptyDataIfNotFound added in v0.45.0

func (o *GetSingleEntryOptions) ReturnEmptyDataIfNotFound() bool

type GetSingleEntryOptionsBuilder added in v0.45.0

type GetSingleEntryOptionsBuilder struct {
	GetEntryOptionsBuilder
	ReturnEmptyDataIfNotFound bool
}

func (*GetSingleEntryOptionsBuilder) Build added in v0.45.0

type JsonData added in v0.33.0

type JsonData map[string]string

type JsonDataList added in v0.33.0

type JsonDataList struct {
	Limit int64
	Page  int64
	Total int64
	Data  []JsonData
}

type JsonFilter added in v0.33.0

type JsonFilter struct {
	// all these field filters have to match
	Fields map[string]FieldJsonFilter
	// these filters will be calculated using the and operator
	And []JsonFilter
	// these filters will be calculated using the or operator
	Or []JsonFilter
}

type JsonUpsertResponse added in v0.33.0

type JsonUpsertResponse struct {
	ValidationErrors      []string
	FieldValidationErrors map[string]string
	Data                  JsonData
	ID                    string
}

type JsonWait added in v0.33.0

type JsonWait struct {
	ConditionFilter  *JsonFilter
	ConditionTimeout time.Duration
}

type ListWait added in v0.44.0

type ListWait struct {
	Condition        []ListWaitCondition
	ConditionTimeout time.Duration
}

type ListWaitCondition added in v0.44.0

type ListWaitCondition struct {
	Operation string
	Value     int64
}

type ManagementClient

type ManagementClient interface {
	DeploySchema(
		ctx context.Context,
		deploymentId int64,
		namespace string,
		projectionTypes []ObjectType,
		crudTypes []ObjectType,
		nestedTypes []ObjectType,
		enums []EnumType,
		views []View,
		baseViews []View,
		options *DeploymentOptions,
	) error
	ActivateSchema(ctx context.Context, deploymentId int64) error
	ConfirmSchema(ctx context.Context, deploymentId int64) error
	RollbackSchema(ctx context.Context, namespace string, target managementpb.DeploymentTarget) error
	RollbackSchemaByDeployment(ctx context.Context, deploymentId int64) error
	GetSchemaDeployment(ctx context.Context, deploymentId int64) (uint32, error)
	Close() error
}

func NewManagementClient

func NewManagementClient(
	conf *config.Config,
) (ManagementClient, error)

type MockDeliveryClient

type MockDeliveryClient struct {
	mock.Mock
}

func (*MockDeliveryClient) Close

func (c *MockDeliveryClient) Close() error

func (*MockDeliveryClient) DeleteDataByFilter

func (c *MockDeliveryClient) DeleteDataByFilter(
	ctx context.Context,
	projection string,
	authData *AuthData,
	filter *Filter,
	eventMetadata *EventMetadata,
) (int64, error)

func (*MockDeliveryClient) DeleteDataById

func (c *MockDeliveryClient) DeleteDataById(
	ctx context.Context,
	projection string,
	authData *AuthData,
	id string,
	eventMetadata *EventMetadata,
) (int64, error)

func (*MockDeliveryClient) DeleteDataByJsonFilter added in v0.33.0

func (c *MockDeliveryClient) DeleteDataByJsonFilter(
	ctx context.Context,
	projection string,
	authData *AuthData,
	filter *JsonFilter,
	eventMetadata *EventMetadata,
) (int64, error)

func (*MockDeliveryClient) GetData

func (c *MockDeliveryClient) GetData(
	ctx context.Context,
	projection string,
	authData *AuthData,
	id string,
	filter *Filter,
	wait *Wait,
	options *GetSingleEntryOptions,
) (*Data, error)

func (*MockDeliveryClient) GetDataList

func (c *MockDeliveryClient) GetDataList(
	ctx context.Context,
	projection string,
	authData *AuthData,
	pagination *Pagination,
	filter *Filter,
	order []Order,
	wait *ListWait,
	options *GetEntryOptions,
) (*DataList, error)

func (*MockDeliveryClient) GetJsonData added in v0.33.0

func (c *MockDeliveryClient) GetJsonData(
	ctx context.Context,
	projection string,
	authData *AuthData,
	id string,
	filter *JsonFilter,
	wait *JsonWait,
	options *GetSingleEntryOptions,
) (*JsonData, error)

func (*MockDeliveryClient) GetJsonDataList added in v0.33.0

func (c *MockDeliveryClient) GetJsonDataList(
	ctx context.Context,
	projection string,
	authData *AuthData,
	pagination *Pagination,
	filter *JsonFilter,
	order []Order,
	wait *ListWait,
	options *GetEntryOptions,
) (*JsonDataList, error)

func (*MockDeliveryClient) GetViewData

func (c *MockDeliveryClient) GetViewData(
	ctx context.Context,
	view string,
	authData *AuthData,
	filter *Filter,
	wait *Wait,
	options *GetEntryOptions,
) (*Data, error)

func (*MockDeliveryClient) GetViewDataList

func (c *MockDeliveryClient) GetViewDataList(
	ctx context.Context,
	view string,
	authData *AuthData,
	pagination *Pagination,
	filter *Filter,
	order []Order,
	wait *ListWait,
	options *GetEntryOptions,
) (*DataList, error)

func (*MockDeliveryClient) GetViewJsonData added in v0.33.0

func (c *MockDeliveryClient) GetViewJsonData(
	ctx context.Context,
	view string,
	authData *AuthData,
	filter *JsonFilter,
	wait *JsonWait,
	options *GetEntryOptions,
) (*JsonData, error)

func (*MockDeliveryClient) GetViewJsonDataList added in v0.33.0

func (c *MockDeliveryClient) GetViewJsonDataList(
	ctx context.Context,
	view string,
	authData *AuthData,
	pagination *Pagination,
	filter *JsonFilter,
	order []Order,
	wait *ListWait,
	options *GetEntryOptions,
) (*JsonDataList, error)

func (*MockDeliveryClient) UpsertData

func (c *MockDeliveryClient) UpsertData(
	ctx context.Context,
	projection string,
	authData *AuthData,
	id string,
	payload Data,
	eventMetadata *EventMetadata,
) (*UpsertResponse, error)

func (*MockDeliveryClient) UpsertJsonData added in v0.33.0

func (c *MockDeliveryClient) UpsertJsonData(
	ctx context.Context,
	projection string,
	authData *AuthData,
	id string,
	payload JsonData,
	eventMetadata *EventMetadata,
) (*JsonUpsertResponse, error)

type MockManagementClient

type MockManagementClient struct {
	mock.Mock
}

func (*MockManagementClient) ActivateSchema added in v0.31.7

func (c *MockManagementClient) ActivateSchema(ctx context.Context, deploymentId int64) error

func (*MockManagementClient) Close

func (c *MockManagementClient) Close() error

func (*MockManagementClient) ConfirmSchema

func (c *MockManagementClient) ConfirmSchema(ctx context.Context, deploymentId int64) error

func (*MockManagementClient) DeploySchema

func (c *MockManagementClient) DeploySchema(
	ctx context.Context,
	deploymentId int64,
	namespace string,
	projectionTypes []ObjectType,
	crudTypes []ObjectType,
	nestedTypes []ObjectType,
	enums []EnumType,
	views []View,
	baseViews []View,
	options *DeploymentOptions,
) error

func (*MockManagementClient) GetSchemaDeployment

func (c *MockManagementClient) GetSchemaDeployment(ctx context.Context, deploymentId int64) (uint32, error)

func (*MockManagementClient) RollbackSchema

func (c *MockManagementClient) RollbackSchema(
	ctx context.Context,
	namespace string,
	target managementpb.DeploymentTarget,
) error

func (*MockManagementClient) RollbackSchemaByDeployment added in v0.31.8

func (c *MockManagementClient) RollbackSchemaByDeployment(ctx context.Context, deploymentId int64) error

type ObjectType

type ObjectType struct {
	Name       string
	Directives []TypeDirective
	Fields     []TypeField
}

type Order

type Order struct {
	Field      string
	Descending bool
}

type Pagination

type Pagination struct {
	Limit int64
	Page  int64
}

type TypeArgument

type TypeArgument struct {
	Name  string
	Value any
}

type TypeDirective

type TypeDirective struct {
	Name      string
	Arguments []TypeArgument
}

type TypeField

type TypeField struct {
	Name       string
	Type       []string
	Directives []TypeDirective
}

type UpsertResponse

type UpsertResponse struct {
	ValidationErrors      []string
	FieldValidationErrors map[string]string
	Data                  Data
	ID                    string
}

type View

type View struct {
	Name       string
	Sql        string
	Directives []TypeDirective
	Fields     []TypeField
}

type Wait

type Wait struct {
	ConditionFilter  *Filter
	ConditionTimeout time.Duration
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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