aefire

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2020 License: Apache-2.0 Imports: 34 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
View Source
var Storage *storage.Client

Functions

func AddComma added in v0.0.18

func AddComma(s string) string

func AddDateHyphen added in v0.0.18

func AddDateHyphen(d, whenEmpty string) string

func AuthCronMiddleware added in v0.0.12

func AuthCronMiddleware(next echo.HandlerFunc) echo.HandlerFunc

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 CountryCodePrefix added in v0.0.14

func CountryCodePrefix(countryCode int) string

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 EndPoint added in v0.0.18

func EndPoint() string

func GAEAppID added in v0.0.18

func GAEAppID() string

func GAEServiceID added in v0.0.18

func GAEServiceID() string

func HMacSha1 added in v0.0.16

func HMacSha1(key, message []byte) (string, error)

func HyphenCorpNum added in v0.0.18

func HyphenCorpNum(s string) string

func HyphenPhoneNum added in v0.0.18

func HyphenPhoneNum(s string) string

func HyphenWhenEmpty added in v0.0.18

func HyphenWhenEmpty(s string) string

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 KRTimezone added in v0.0.12

func KRTimezone() *time.Location

func LastOf added in v0.0.26

func LastOf(arr []string) string

func LocalizeAndFormatPhoneNumber added in v0.0.14

func LocalizeAndFormatPhoneNumber(phoneNumber string, countryCode int) (localNumber string)

func LocalizePhoneNumber added in v0.0.14

func LocalizePhoneNumber(phoneNumber string, countryCode int) (localNumber string)

func LogIfError

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

func MD5Base64 added in v0.0.16

func MD5Base64(message []byte) (string, error)

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 NormalizePhoneNumber added in v0.0.14

func NormalizePhoneNumber(phoneNumber string, countryCode int) string

func PanicIfError

func PanicIfError(vs ...interface{})

func PathMerge added in v0.0.18

func PathMerge(path string, pairs ...interface{}) error

func PathTo

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

func QueryStringField added in v0.0.18

func QueryStringField(q firestore.Query, field string) (fieldValues map[string]string)

func Random added in v0.0.15

func Random(min, max int64) int64

func Round added in v0.0.15

func Round(x, unit float64) float64

func ServiceEndPoint added in v0.0.18

func ServiceEndPoint(serviceID string) string

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 StorageBucket added in v0.0.27

func StorageBucket() *storage.BucketHandle

func StorageObject added in v0.0.27

func StorageObject(storageUrl string) *storage.ObjectHandle

func StoreBytes added in v0.0.28

func StoreBytes(c context.Context, b []byte, filePath string) error

func StoreReader added in v0.0.28

func StoreReader(c context.Context, reader io.ReadCloser, filePath string) error

func StringMapOf

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

func StringMapValuesToSlice added in v0.0.18

func StringMapValuesToSlice(m map[string]string) (s []string)

func TimeNowRef

func TimeNowRef() *time.Time

func Timezone added in v0.0.12

func Timezone(hours, minutes int) *time.Location

func ToJson

func ToJson(v interface{}, indent ...string) string

func ToMap

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

func UID added in v0.0.12

func UID(c echo.Context) string

func UpdateQueryResults

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

func UpdatesOf

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

func UrlValuesOf added in v0.0.17

func UrlValuesOf(args ...string) url.Values

func UserToken

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

func ValidateCorpNum added in v0.0.13

func ValidateCorpNum(n string) bool

func ValidateIdToken

func ValidateIdToken(next echo.HandlerFunc) echo.HandlerFunc

func ValidateLocalCellPhoneNumber added in v0.0.13

func ValidateLocalCellPhoneNumber(phoneNumber string) bool

func ValidateRRN added in v0.0.13

func ValidateRRN(n string) bool

Types

type AEError added in v0.0.3

type AEError string

func (AEError) Error added in v0.0.3

func (e AEError) Error() string

type AEFContext added in v0.1.0

type AEFContext struct {
	context.Context
	*AEFire
}

func (*AEFContext) BatchMerge added in v0.1.0

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

func (*AEFContext) BatchMergeObj added in v0.1.0

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

func (*AEFContext) BatchMergePath added in v0.1.0

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

func (*AEFContext) Col added in v0.1.0

func (a *AEFContext) Col(path ...string) *firestore.CollectionRef

func (*AEFContext) DeleteQueryResults added in v0.1.0

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

func (*AEFContext) Doc added in v0.1.0

func (a *AEFContext) Doc(path ...string) *firestore.DocumentRef

func (*AEFContext) DocMerge added in v0.1.0

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

func (*AEFContext) DocMergeObj added in v0.1.0

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

func (*AEFContext) MessageToTokens added in v0.1.0

func (a *AEFContext) MessageToTokens(tokens []string, msg *messaging.Message) map[string]error

func (*AEFContext) PathMerge added in v0.1.0

func (a *AEFContext) PathMerge(path string, pairs ...interface{}) error

func (*AEFContext) PathTo added in v0.1.0

func (a *AEFContext) PathTo(to interface{}, path ...string) error

func (*AEFContext) QueryStringField added in v0.1.0

func (a *AEFContext) QueryStringField(q firestore.Query, field string) (fieldValues map[string]string)

func (*AEFContext) Snap added in v0.1.0

func (a *AEFContext) Snap(path ...string) (*firestore.DocumentSnapshot, error)

func (*AEFContext) SnapTo added in v0.1.0

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

func (*AEFContext) UpdateQueryResults added in v0.1.0

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

type AEFire added in v0.1.0

type AEFire struct {
	App     *firebase.App
	Store   *firestore.Client
	Storage *storage.Client
	FCM     *messaging.Client
	Auth    *auth.Client
	IID     *iid.Client
}

func New added in v0.1.0

func New(config *firebase.Config, opts ...option.ClientOption) *AEFire

func (*AEFire) NewContext added in v0.1.0

func (a *AEFire) NewContext(c context.Context) *AEFContext

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

type MessageBuilder added in v0.1.0

type MessageBuilder struct {
	messaging.Message
}

func NewMessageBuilder added in v0.1.0

func NewMessageBuilder() *MessageBuilder

func (*MessageBuilder) Body added in v0.1.0

func (m *MessageBuilder) Body(body string) *MessageBuilder

func (*MessageBuilder) Data added in v0.1.0

func (m *MessageBuilder) Data(key, value string) *MessageBuilder

func (*MessageBuilder) Priority added in v0.1.0

func (m *MessageBuilder) Priority(p string) *MessageBuilder

func (*MessageBuilder) SetToken added in v0.1.0

func (m *MessageBuilder) SetToken(t string) *MessageBuilder

func (*MessageBuilder) Title added in v0.1.0

func (m *MessageBuilder) Title(title string) *MessageBuilder

func (*MessageBuilder) Topic added in v0.1.0

func (m *MessageBuilder) Topic(topic string) *MessageBuilder

Jump to

Keyboard shortcuts

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