pal

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GET_DOCUMENT_ERROR     = "error getting document from data store:"
	WRITE_BATCH_ERROR      = "error writing batch to data store:"
	ACCESS_REQUEST_ERROR   = "error processing access request:"
	DELETION_REQUEST_ERROR = "error processing deletion request:"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClientWithFirestore

func NewClientWithFirestore(firestoreClient *firestore.Client) *Client

func NewClientWithMongo

func NewClientWithMongo(mongoDb *mongo.Database) *Client

func (*Client) ProcessAccessRequest

func (pal *Client) ProcessAccessRequest(handleAccess HandleAccessFunc, dataSubjectLocator Locator, dataSubjectID string) (map[string]interface{}, error)

func (*Client) ProcessDeletionRequest

func (pal *Client) ProcessDeletionRequest(handleDeletion HandleDeletionFunc, dataSubjectLocator Locator, dataSubjectID string, writeToDatabase bool) (string, error)

type DatabaseObject

type DatabaseObject map[string]interface{}

type FieldUpdates added in v1.0.0

type FieldUpdates struct {
	FirestoreUpdates []firestore.Update
	MongoUpdates     []interface{}
}

type Filter added in v1.0.0

type Filter struct {
	Path  string
	Op    string
	Value interface{}
}

type FirestoreLocator

type FirestoreLocator struct {
	// Collection path leading up to the document in Firestore
	// E.g. "[users]", "[courses,sections]"
	CollectionPath []string
	// List of document IDs in the order of collections
	DocIDs []string
	// List of filters to be applied to a collection. Ignored if type is document.
	Filters []Filter
}

type HandleAccessFunc

type HandleAccessFunc func(dataSubjectId string, currentDbObjLocator Locator, dbObj DatabaseObject) (data map[string]interface{}, err error)

type HandleDeletionFunc

type HandleDeletionFunc func(dataSubjectId string, currentDbObjLocator Locator, dbObj DatabaseObject) (nodesToTraverse []Locator, deleteNode bool, fieldsToUpdate FieldUpdates, err error)

Only one of deleteNode and fieldsToUpdate should be set. If deleteNode is set, fieldsToUpdate will be ignored (node will be deleted).

type Locator

type Locator struct {
	LocatorType LocatorType
	DataType    string
	// Only one of FirestoreLocator and MongoLocator should be set
	FirestoreLocator
	MongoLocator
}

type LocatorType

type LocatorType string
const (
	Document   LocatorType = "document"
	Collection LocatorType = "collection"
)

type MongoLocator

type MongoLocator struct {
	Collection string
	Filter     bson.D
}

Jump to

Keyboard shortcuts

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