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 ¶
- func CompactErrors(errorChannels []chan error, headMessage string) (err error)
- func Create(queryable common.Queryable) error
- func CreateData(data *common.Data) error
- func Delete(queryable common.Queryable) error
- func DeleteData(firestoreID string) error
- func DeprecateData(firestoreID string, IndustryID string, DomainID string, ContextID string) error
- func Init(initBaseDirectory string) error
- func Read(queryable common.Queryable) error
- func ReadAll(lastUpdate int64) (data []*common.Data, role []*common.Role, schema []*common.Schema, ...)
- func ReadData(firestoreID string) (common.Data, error)
- func Update(queryable common.Queryable) error
- func UpdateData(data *common.Data) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompactErrors ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 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 Update ¶
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 ¶
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.