Documentation ¶
Overview ¶
Package firebase impleements a RESTful client for Firebase.
Index ¶
- func TimeoutDialer(cTimeout time.Duration, rwTimeout time.Duration) func(net, addr string) (c net.Conn, err error)
- type Api
- type Client
- func (c *Client) Child(path string, params map[string]string, v interface{}) *Client
- func (c *Client) Init(root, auth string, api Api)
- func (c *Client) Push(value interface{}, params map[string]string) (*Client, error)
- func (c *Client) Remove(path string, params map[string]string) error
- func (c *Client) Rules(params map[string]string) (Rules, error)
- func (c *Client) Set(path string, value interface{}, params map[string]string) (*Client, error)
- func (c *Client) SetRules(rules *Rules, params map[string]string) error
- func (c *Client) Update(path string, value interface{}, params map[string]string) error
- func (c *Client) Value() interface{}
- type Rules
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Api ¶
type Api interface {
Call(method, path, auth string, body []byte, params map[string]string) ([]byte, error)
}
Api is the interface for interacting with Firebase. Consumers of this package can mock this interface for testing purposes.
type Client ¶
type Client struct { // Url is the client's base URL used for all calls. Url string // Auth is authentication token used when making calls. // The token is optional and can also be overwritten on an individual // call basis via params. Auth string // contains filtered or unexported fields }
Client is the Firebase client.
func (*Client) Child ¶
Child returns a populated pointer for a given path. If the path cannot be found, a null pointer is returned.
func (*Client) Init ¶
Init initializes the Firebase client with a given root url and optional auth token. The initialization can also pass a mock api for testing purposes.
func (*Client) Push ¶
Push creates a new value under the current root url. A populated pointer with that value is also returned.
func (*Client) Set ¶
Set overwrites the value at the specified path and returns populated pointer for the updated path.