fileCRUD

package
v0.0.0-...-646b7d3 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

package fileCRUD contains APIs for CRUDing objects to and from a local filesystem using JSON. When done in a localhost or development environment which allows editing the file system, these files can be committed to the git repo. This can be helpful for migrating data between environments while ensuring each environment has the same data when the environment is created or updated.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompactErrors

func CompactErrors(errorChannels []chan error, headMessage string) (err error)

CompactErrors will wait for an error on each error channel and then compress the resulting error into a single error message, prepended with the 'headMessage'

func Create

func Create(queryable common.Queryable) error

Create add the given object to the file system.

Note: only works on localhost because installation MUST originate from localhost & proceed through each environment thereafter. Adding files in Staging would mean the files would have skipped testing in Development.

func CreateData

func CreateData(data *common.Data) error

CreateData add the given Data object to the file system.

Note: only works on localhost because installation MUST originate from localhost & proceed through each environment thereafter. Adding files in Staging would mean the files would have skipped testing in Development.

func Delete

func Delete(queryable common.Queryable) error

Delete removes a document. Allows you to delete documents which do not exist.

Note: only works on localhost because installation MUST originate from localhost & proceed through each environment thereafter. Adding files in Staging would mean the files would have skipped testing in Development.

func DeleteData

func DeleteData(firestoreID string) error

DeleteData removes a document. Allows you to delete documents which do not exist.

Note: only works on localhost because installation MUST originate from localhost & proceed through each environment thereafter. Adding files in Staging would mean the files would have skipped testing in Development.

func DeprecateData

func DeprecateData(firestoreID string, IndustryID string, DomainID string, ContextID string) error

DeprecateData sets the 'polyappDeprecated' property.

Note: only works on localhost because installation MUST originate from localhost & proceed through each environment thereafter. Adding files in Staging would mean the files would have skipped testing in Development.

func Init

func Init(initBaseDirectory string) error

Init sets the baseDirectory, which specifies where in the file system to put all of the documents. This function fails if you have not already created the base directory in the file system.

func Read

func Read(queryable common.Queryable) error

Read reads some queryable from the file system.

func ReadAll

func ReadAll(lastUpdate int64) (data []*common.Data, role []*common.Role, schema []*common.Schema, task []*common.Task,
	user []*common.User, ux []*common.UX, bot []*common.Bot, action []*common.Action, publicMap []*common.PublicMap, CSS []*common.CSS, err error)

ReadAll reads all documents in all collections into arrays of data structures. It is used for importing / exporting an entire (small) database. Just remember this code does not have any handling for incremental DB changes so it's not suitable for big DBs.

func ReadData

func ReadData(firestoreID string) (common.Data, error)

ReadData reads some data from the file system.

func Update

func Update(queryable common.Queryable) error

Update adds a new Queryable to its collection in the file system.

Note: only works on localhost because installation MUST originate from localhost & proceed through each environment thereafter. Adding files in Staging would mean the files would have skipped testing in Development.

func UpdateData

func UpdateData(data *common.Data) error

UpdateData adds some new data to the Data object in the file system.

Note: only works on localhost because installation MUST originate from localhost & proceed through each environment thereafter. Adding files in Staging would mean the files would have skipped testing in Development.

Types

This section is empty.

Jump to

Keyboard shortcuts

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