aefire

package module
v0.2.19 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2020 License: Apache-2.0 Imports: 36 Imported by: 5

README

aefire

Convenient functions firebase-sdk for golang on google appengine standard

Documentation

Index

Constants

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

Variables

This section is empty.

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

func CountryCodePrefix(countryCode int) string

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 GetEnv added in v0.2.15

func GetEnv(key string, defaultValue string) string

func GetEnvInt added in v0.2.15

func GetEnvInt(key string, defaultValue int) int

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 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 LastPathSegments added in v0.1.8

func LastPathSegments(r *http.Request) 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 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 PathSegments added in v0.1.8

func PathSegments(r *http.Request) []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 SnapTo

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

func StorageObjectUrl added in v0.2.2

func StorageObjectUrl(obj *storage.ObjectHandle) string

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 TokenIID added in v0.2.19

func TokenIID(token string) string

func UID added in v0.0.12

func UID(c context.Context) string

func UrlValuesOf added in v0.0.17

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

func UserToken

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

func ValidateCorpNum added in v0.0.13

func ValidateCorpNum(n string) bool

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 AEFire added in v0.1.0

type AEFire struct {
	context.Context
	App     *firebase.App
	FStore  *firestore.Client
	Storage *storage.Client
	FCM     *messaging.Client
	Auth    *auth.Client
	IID     *iid.Client

	DB *sqlx.DB
	// contains filtered or unexported fields
}

func New added in v0.1.0

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

func WithContext added in v0.2.0

func WithContext(c context.Context, config *firebase.Config, opts ...option.ClientOption) *AEFire

func (*AEFire) BatchMerge added in v0.2.0

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

func (*AEFire) BatchMergeObj added in v0.2.0

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

func (*AEFire) BatchMergePath added in v0.2.0

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

func (*AEFire) Col added in v0.2.0

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

func (*AEFire) ConnectDB added in v0.2.13

func (aef *AEFire) ConnectDB(param DatabaseParam) *AEFire

func (*AEFire) DeleteQueryResults added in v0.2.0

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

func (*AEFire) Doc added in v0.2.0

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

func (*AEFire) DocMerge added in v0.2.0

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

func (*AEFire) DocMergeObj added in v0.2.0

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

func (*AEFire) IdTokenAuth added in v0.1.5

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

func (*AEFire) MessageToTokens added in v0.2.0

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

func (*AEFire) PathMerge added in v0.2.0

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

func (*AEFire) PathTo added in v0.2.0

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

func (*AEFire) QueryStringField added in v0.2.0

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

func (*AEFire) Snap added in v0.2.0

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

func (*AEFire) SnapTo added in v0.2.0

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

func (*AEFire) StorageBucket added in v0.2.1

func (a *AEFire) StorageBucket() *storage.BucketHandle

func (*AEFire) StorageObject added in v0.2.1

func (a *AEFire) StorageObject(storageUrl string) *storage.ObjectHandle

func (*AEFire) StoreBytes added in v0.2.1

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

func (*AEFire) StoreReader added in v0.2.1

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

func (*AEFire) UID added in v0.2.1

func (a *AEFire) UID() string

func (*AEFire) UpdateQueryResults added in v0.2.0

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

func (*AEFire) UserRecord added in v0.2.1

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

func (*AEFire) UserToken added in v0.2.1

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

func (*AEFire) ValidateIdToken added in v0.1.5

func (aef *AEFire) ValidateIdToken(next echo.HandlerFunc) echo.HandlerFunc

func (*AEFire) WithContext added in v0.2.0

func (aef *AEFire) WithContext(c context.Context) *AEFire

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 DatabaseParam added in v0.2.13

type DatabaseParam struct {
	DriverName   string
	Url          string
	MaxOpenConns int
	MaxIdleConns int
}

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) Channel added in v0.2.9

func (m *MessageBuilder) Channel(channel 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