db

package
v0.0.0-...-47c56e1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2020 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Db

type Db struct {
	App *firebase.Firebase
}

Db has all the functions to interact with a firebase realtime database

func CreateDatabase

func CreateDatabase(app *firebase.Firebase) *Db

CreateDatabase will return a database initialized with the app

func (*Db) Get

func (db *Db) Get(path string) ([]byte, error)

Get will get an array of bytes of the data at a certain path.

func (*Db) GetData

func (db *Db) GetData(path string) (interface{}, error)

GetData will get an interface{} of the data at a certain path.

func (*Db) Set

func (db *Db) Set(path string, data []byte) error

Set will set the data at a path to an array of bytes

func (*Db) SetData

func (db *Db) SetData(path string, data interface{}) error

SetData will set the data at a path to an interface{}

func (*Db) Stream

func (db *Db) Stream(path string, handler func(StreamEvent, error))

Stream will call a handler on any changes to the database

type StreamEvent

type StreamEvent struct {
	Path    string
	AbsPath string
	Data    interface{}
}

StreamEvent contains the data in a stream event sent by firebase

Jump to

Keyboard shortcuts

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