pal

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GET_DOCUMENT_ERROR     = "error getting document from Firestore:"
	WRITE_BATCH_ERROR      = "error writing batch to Firestore:"
	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 NewClient

func NewClient(firestoreClient *firestore.Client) *Client

func (*Client) ProcessAccessRequest

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

func (*Client) ProcessDeletionRequest

func (pal *Client) ProcessDeletionRequest(dataSubjectLocator Locator, dataSubjectID string) (DeletionResult, error)

type DataNode

type DataNode interface {
	HandleAccess(dataSubjectId string, currentDocumentID string) map[string]interface{}
	// Only one of deleteNode and fieldsToUpdate should be set.
	// If deleteNode is set, fieldsToUpdate will be ignored (node will be deleted).
	HandleDeletion(dataSubjectId string) (nodesToTraverse []Locator, deleteNode bool, fieldsToUpdate []firestore.Update)
}

type DeletionResult

type DeletionResult struct {
	NumDocumentsDeleted int
	NumDocumentsUpdated int
}

type Locator

type Locator struct {
	Type LocatorType
	// 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 queries to be applied to a collection. Ignored if type is document.
	Queries []Query
	// An empty struct that will be populated with the data from Firestore
	NewDataNode func() DataNode
}

type LocatorType

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

type Query

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

Jump to

Keyboard shortcuts

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