firestore

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

README

stored-firestore

A GCP Firestore driver for the StorEd data respository.

Status: In-Development

Instantiate FireStore, then use the stored.Store interface.

// Using default marshal / unmarshal
var fs stored.Store = NewFireStore(project, nil, nil)

func Domain(store *stored.Store) {

	err := store.StoreItem(id, data)
	if err != nil {
		// Handle storage error.
	}

	obj, err := fs.Retrieve(id)
	if err != nil {
		// Handle read error.
	}
}

Domain(fs)

Features

  • Store data in the GCP cloud using Firestore.
  • Decoupled domain and storage logic.

Upcoming:

  • Transactions.
  • Triggers.
  • Limit operations by Criterria.

Installation

go get kilobit.cs/go/stored-firestore

Building

cd kilobit.ca/go/stored-firestore
go test -v
go build

Contribute

Please submit a pull request with any bug fixes or feature requests that you have. All submissions imply consent to use / distribute under the terms of the LICENSE.

Support

Submit tickets through github.

License

See LICENSE.

Links to 3rd party content that may have it's own licensing.

--
Created: Dec 17, 2019
By: Christian Saunders cps@kilobit.ca
Copyright 2019 Kilobit Labs Inc.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FireStore

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

func NewFireStore

func NewFireStore(project string, opts ...Option) *FireStore

func (*FireStore) Apply

func (fs *FireStore) Apply(f ItemHandler) error

func (*FireStore) Close

func (fs *FireStore) Close()

func (*FireStore) Delete

func (fs *FireStore) Delete(id ID) error

func (*FireStore) List

func (fs *FireStore) List() ([]ID, error)

Currently lists ids for all documents in the entire store.

func (*FireStore) Options

func (fs *FireStore) Options(opts ...Option)

func (*FireStore) Retrieve

func (fs *FireStore) Retrieve(id ID) (Storable, error)

func (*FireStore) StoreItem

func (fs *FireStore) StoreItem(id ID, obj Storable) error

type Marshaler

type Marshaler func(Storable) (interface{}, error)

type Option

type Option func(*FireStore)

func OptCollection

func OptCollection(collection string) Option

func OptMarshaler

func OptMarshaler(m Marshaler) Option

func OptUnMarshaler

func OptUnMarshaler(u UnMarshaler) Option

type UnMarshaler

type UnMarshaler func(interface{}) (Storable, error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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