Documentation
¶
Index ¶
- func SetContextLogger(l ContextLogger)
- type ContextLogger
- type Firestore
- func (f *Firestore) Change(ctx context.Context, name string, ref string) (*keyup.Change, error)
- func (f *Firestore) ChangeAdd(ctx context.Context, name string, ref string) error
- func (f *Firestore) Changes(ctx context.Context, name string, from time.Time, limit int) ([]*keyup.Change, time.Time, error)
- func (f *Firestore) Collections(ctx context.Context, parent string) (keyup.CollectionIterator, error)
- func (f *Firestore) Create(ctx context.Context, path string, b []byte) error
- func (f *Firestore) Delete(ctx context.Context, path string) (bool, error)
- func (f *Firestore) Documents(ctx context.Context, parent string, opts *keyup.DocumentsOpts) (keyup.DocumentIterator, error)
- func (f *Firestore) Exists(ctx context.Context, path string) (bool, error)
- func (f *Firestore) Get(ctx context.Context, path string) (*keyup.Document, error)
- func (f *Firestore) GetAll(ctx context.Context, paths []string) ([]*keyup.Document, error)
- func (f *Firestore) Set(ctx context.Context, path string, b []byte) error
- func (f *Firestore) URI() string
- type LogLevel
- type Logger
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetContextLogger ¶
func SetContextLogger(l ContextLogger)
SetContextLogger sets logger for the package.
Types ¶
type ContextLogger ¶
type ContextLogger interface { Debugf(ctx context.Context, format string, args ...interface{}) Infof(ctx context.Context, format string, args ...interface{}) Warningf(ctx context.Context, format string, args ...interface{}) Errorf(ctx context.Context, format string, args ...interface{}) }
ContextLogger interface used in this package with request context.
type Firestore ¶
type Firestore struct {
// contains filtered or unexported fields
}
Firestore ...
func NewFirestore ¶
func NewFirestore(uri string, opts ...option.ClientOption) (*Firestore, error)
NewFirestore creates a Firestore
Example ¶
url := "firestore://chilltest-3297b" opts := []option.ClientOption{option.WithCredentialsFile("credentials.json")} fs, err := NewFirestore(url, opts...) if err != nil { log.Fatal(err) } exists, existsErr := fs.Exists(context.TODO(), "/test/1") if existsErr != nil { log.Fatal(existsErr) } if exists { if _, err := fs.Delete(context.TODO(), "/test/1"); err != nil { log.Fatal(err) } } if err := fs.Create(context.TODO(), "/test/1", []byte("value1")); err != nil { log.Fatal(err) } entry, err := fs.Get(context.TODO(), "/test/1") if err != nil { log.Fatal(err) } fmt.Printf("%s\n", entry.Path) fmt.Printf("%s\n", entry.Data)
Output: /test/1 value1
func (*Firestore) Changes ¶
func (f *Firestore) Changes(ctx context.Context, name string, from time.Time, limit int) ([]*keyup.Change, time.Time, error)
Changes ...
func (*Firestore) Collections ¶
func (f *Firestore) Collections(ctx context.Context, parent string) (keyup.CollectionIterator, error)
Collections ...
func (*Firestore) Documents ¶
func (f *Firestore) Documents(ctx context.Context, parent string, opts *keyup.DocumentsOpts) (keyup.DocumentIterator, error)
Documents ...
Click to show internal directories.
Click to hide internal directories.