gfirestore

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLoaderFactory

func NewLoaderFactory(ctx context.Context, config Config) (entity.LoaderFactory, error)

Types

type Config

type Config struct {

	// ProjectId (required) specifies GCP project ID for this deployment.
	ProjectId string
}

FirestoreConfig

type EntityProperty added in v0.4.0

type EntityProperty struct {
	Name string `json:"name"`

	// Id is the key/field ID in the Transformed output map, which contains the actual value
	// for this property. The value type is the same as the output from the Transform.
	Id string `json:"id"`

	// For most properties this should be set to true, for improved query performance, but for big event
	// fields that might exceed 1500 bytes, this should be set to false, since that is a built-in
	// Firestore limit.
	Index bool `json:"index"`
}

type FirestoreClient

type FirestoreClient interface {
	Put(ctx context.Context, key *datastore.Key, src any) (*datastore.Key, error)
	Get(ctx context.Context, key *datastore.Key, dst any) (err error)
	GetAll(ctx context.Context, q *datastore.Query, dst any) (keys []*datastore.Key, err error)
}

type Kind added in v0.4.0

type Kind struct {
	// If Namespace here is present, it will override the global one.
	// If both are missing, the Kind will use native 'default'
	Namespace string `json:"namespace,omitempty"`
	Name      string `json:"name"`

	// If set, will be used as the actual Entity Name
	EntityName string `json:"entityName,omitempty"`

	// If set, will be used to create the Entity Name from the "id" values in the Transload output map.
	// The value is currently restricted to be of type string.
	EntityNameFromIds struct {
		Ids       []string `json:"ids,omitempty"`
		Delimiter string   `json:"delimiter,omitempty"`
	} `json:"entityNameFromIds,omitempty"`

	Properties []EntityProperty `json:"properties,omitempty"`
}

The Kind struct is used for Firestore sinks (in datastore mode). Currently, one of EntityName or EntityNameFromIds needs to be present in spec. TODO: Add creation of UUID if EntityName/Ref not present

type Query

type Query struct {
	Type         QueryType
	Namespace    string
	Kind         string
	EntityName   string
	CompositeKey []entity.KeyValueFilter
}

CompositeKey works as a SQL 'WHERE key1 = value1 and key2 = value2 ...' for all props in a stream spec with index=true. Due to the simple nature of GEIST GET /streams/.../events?... API, only string values are supported. A more full-fledged query API should be provided by a separate query service, so no need to support complex queries in GEIST.

type QueryType

type QueryType int
const (
	Unknown QueryType = iota
	KeyValue
	CompositeKeyValue
	All
)

type SinkConfig added in v0.4.0

type SinkConfig struct {
	Kinds []Kind `json:"kinds,omitempty"` // TODO: Probably remove array and keep single object
}

SinkConfig specifies the schema for the "customConfig" field in the "sink" section of the stream spec. It enables arbitrary connector specific fields to be present in the stream spec.

func NewSinkConfig added in v0.4.0

func NewSinkConfig(spec *entity.Spec) (sc SinkConfig, err error)

Jump to

Keyboard shortcuts

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