aefire

package module
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2019 License: Apache-2.0 Imports: 16 Imported by: 5

README

aefire

Convenient functions firebase-sdk for golang on google appengine standard

Documentation

Index

Constants

View Source
const (
	DocumentNotFound = AEError("DocumentNotFound")
)

Variables

View Source
var FAuth *auth.Client
View Source
var FIID *iid.Client

Functions

func BatchMerge

func BatchMerge(b *firestore.WriteBatch, doc *firestore.DocumentRef, pairs ...interface{}) *firestore.WriteBatch

func BatchMergeObj

func BatchMergeObj(b *firestore.WriteBatch, path string, o interface{}) *firestore.WriteBatch

func BatchMergePath

func BatchMergePath(b *firestore.WriteBatch, path string, pairs ...interface{}) *firestore.WriteBatch

func Col

func Col(path string) *firestore.CollectionRef

func DeleteQueryResults

func DeleteQueryResults(q firestore.Query, b *firestore.WriteBatch) error

func Doc

func Doc(path string) *firestore.DocumentRef

func DocMerge

func DocMerge(doc *firestore.DocumentRef, pairs ...interface{}) error

func DocMergeObj

func DocMergeObj(doc *firestore.DocumentRef, o interface{}) error

func IdTokenAuth

func IdTokenAuth(key string, c echo.Context) (result bool, err error)

func Init

func Init()

func InitWith added in v0.0.3

func InitWith(keyFile string, envPairs ...string)

func JSONError

func JSONError(c echo.Context, code int, msg string) error

func JsonMap

func JsonMap(c echo.Context, pairs ...interface{}) error

func JsonMsg

func JsonMsg(c echo.Context, msg string) error

func JsonOk

func JsonOk(c echo.Context) error

func LogIfError

func LogIfError(vs ...interface{}) bool

func MapOf

func MapOf(pairs ...interface{}) map[string]interface{}

func MessageToToken added in v0.0.3

func MessageToToken(token, title, body, priority string, notRegisteredTokenHandler func(fcmToken FcmToken), datas ...string) error

func MessageToTokens added in v0.0.3

func MessageToTokens(tokens []string, title, body, priority string, notRegisteredTokensHandler func([]FcmToken), datas ...string) map[string]error

func MessageToTopic added in v0.0.3

func MessageToTopic(topic, title, body, priority string, datas ...string) error

func NewBatch

func NewBatch() *firestore.WriteBatch

func NewEcho

func NewEcho() *echo.Echo

func PanicIfError

func PanicIfError(vs ...interface{})

func PathTo

func PathTo(path string, to interface{}) error

func Snap

func Snap(path string) *firestore.DocumentSnapshot

func SnapExists

func SnapExists(snap *firestore.DocumentSnapshot) bool

func SnapTo

func SnapTo(snap *firestore.DocumentSnapshot, to interface{}) error

func StringMapOf

func StringMapOf(pairs ...string) map[string]string

func TimeNowRef

func TimeNowRef() *time.Time

func ToJson

func ToJson(v interface{}) string

func ToMap

func ToMap(v interface{}) (m map[string]interface{})

func UpdateQueryResults

func UpdateQueryResults(q firestore.Query, b *firestore.WriteBatch, updates ...interface{}) error

func UpdatesOf

func UpdatesOf(pairs ...interface{}) []firestore.Update

func UserToken

func UserToken(c echo.Context) *auth.Token

func ValidateIdToken

func ValidateIdToken(next echo.HandlerFunc) echo.HandlerFunc

Types

type AEContext added in v0.0.3

type AEContext struct {
	echo.Context
}

func (*AEContext) Header added in v0.0.3

func (a *AEContext) Header(key string) string

func (*AEContext) JSONError added in v0.0.3

func (a *AEContext) JSONError(code int, msg string) error

func (*AEContext) JsonMap added in v0.0.3

func (a *AEContext) JsonMap(pairs ...interface{}) error

func (*AEContext) JsonMsg added in v0.0.3

func (a *AEContext) JsonMsg(msg string) error

func (*AEContext) JsonOk added in v0.0.3

func (a *AEContext) JsonOk() error

func (*AEContext) LastPathSegments added in v0.0.3

func (a *AEContext) LastPathSegments() string

func (*AEContext) PathSegments added in v0.0.3

func (a *AEContext) PathSegments() []string

func (*AEContext) ReqContext added in v0.0.3

func (a *AEContext) ReqContext() context.Context

func (*AEContext) UID added in v0.0.3

func (a *AEContext) UID() string

func (*AEContext) UserRecord added in v0.0.3

func (a *AEContext) UserRecord() *auth.UserRecord

func (*AEContext) UserToken added in v0.0.3

func (a *AEContext) UserToken() *auth.Token

type AEError added in v0.0.3

type AEError string

func (AEError) Error added in v0.0.3

func (e AEError) Error() string

type Credential added in v0.0.3

type Credential struct {
	Type                    string `json:"type"`
	ProjectID               string `json:"project_id"`
	PrivateKeyID            string `json:"private_key_id"`
	PrivateKey              string `json:"private_key"`
	ClientEmail             string `json:"client_email"`
	ClientID                string `json:"client_id"`
	AuthURI                 string `json:"auth_uri"`
	TokenURI                string `json:"token_uri"`
	AuthProviderX509CertURL string `json:"auth_provider_x509_cert_url"`
	ClientX509CertURL       string `json:"client_x509_cert_url"`
}

type Device

type Device struct {
	UID         *string    `json:"uid,omitempty" firestore:"uid,omitempty"`
	IID         string     `json:"iid" firestore:"iid"`
	Token       *string    `json:"token,omitempty" firestore:"token,omitempty"`
	PhoneNumber *string    `json:"phoneNumber,omitempty" firestore:"phoneNumber,omitempty"`
	CreatedAt   *time.Time `json:"createdAt" firestore:"createdAt"`
	UserAgent   string     `json:"userAgent" firestore:"userAgent"`
}

func (*Device) DocId

func (d *Device) DocId() string

type FcmToken added in v0.0.3

type FcmToken string

func (*FcmToken) IID added in v0.0.3

func (t *FcmToken) IID() string

Jump to

Keyboard shortcuts

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