Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/otiai10/firebase

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/otiai10/firebase

  • v0.0.0-20170605050909-39a18545c39e
  • Source
  • Go
  • Socket score

Version published
Created
Source

firebase

A Go package for the Firebase API #golang

Installation

Install the package with go:

go get github.com/melvinmt/firebase

And add it to your go file:

package name

import (
    "github.com/melvinmt/firebase"
)

Usage

package main

import (
    "github.com/melvinmt/firebase"
    "fmt"
)

type PersonName struct {
    First string
    Last  string
}

type Person struct {
    Name PersonName
}

func main() {
    var err error

    url := "https://SampleChat.firebaseIO-demo.com/users/fred/name"

    // Can also be your Firebase secret:
    authToken := "MqL0c8tKCtheLSYcygYNtGhU8Z2hULOFs9OKPdEp"

    // Auth is optional:
    ref := firebase.NewReference(url).Auth(authToken)

    // Create the value.
    personName := PersonName{
        First: "Fred",
        Last:  "Swanson",
    }

    // Write the value to Firebase.
    if err = ref.Write(personName); err != nil {
        panic(err)
    }

    // Now, we're going to retrieve the person.
    personUrl := "https://SampleChat.firebaseIO-demo.com/users/fred"

    personRef := firebase.NewReference(personUrl).Export(false)

    fred := Person{}

    if err = personRef.Value(fred); err != nil {
        panic(err)
    }

    fmt.Println(fred.Name.First, fred.Name.Last) // prints: Fred Swanson
}

Docs

http://godoc.org/github.com/melvinmt/firebase

FAQs

Package last updated on 05 Jun 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc