Documentation

Index

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.

func NewContextLogger

func NewContextLogger(lev LogLevel) ContextLogger

NewContextLogger ...

type Firestore

type Firestore struct {
	// contains filtered or unexported fields
}

Firestore ...

func New

func New(uri string, opts ...option.ClientOption) (*Firestore, error)

New creates a Firestore

Example
Output:

/test/key1
value1

func (*Firestore) ChangeAdd

func (f *Firestore) ChangeAdd(ctx context.Context, name string, id string, ref string) error

ChangeAdd adds Change.

func (*Firestore) Changes

func (f *Firestore) Changes(ctx context.Context, name string, ts time.Time, limit int, direction ds.Direction) ([]*ds.Change, time.Time, error)

Changes ...

func (*Firestore) Collections

func (f *Firestore) Collections(ctx context.Context, parent string) (ds.CollectionIterator, error)

Collections ...

func (*Firestore) Create

func (f *Firestore) Create(ctx context.Context, path string, b []byte) error

Create document.

func (*Firestore) Delete

func (f *Firestore) Delete(ctx context.Context, path string) (bool, error)

Delete ...

func (*Firestore) DeleteAll

func (f *Firestore) DeleteAll(ctx context.Context, paths []string) error

DeleteAll ...

func (*Firestore) Documents

func (f *Firestore) Documents(ctx context.Context, parent string, opts *ds.DocumentsOpts) (ds.DocumentIterator, error)

Documents ...

func (*Firestore) Exists

func (f *Firestore) Exists(ctx context.Context, path string) (bool, error)

Exists returns true if path exists.

func (*Firestore) Get

func (f *Firestore) Get(ctx context.Context, path string) (*ds.Document, error)

Get ...

func (*Firestore) GetAll

func (f *Firestore) GetAll(ctx context.Context, paths []string) ([]*ds.Document, error)

GetAll paths.

func (*Firestore) Set

func (f *Firestore) Set(ctx context.Context, path string, b []byte) error

Set document.

func (*Firestore) URI

func (f *Firestore) URI() string

URI ...

type LogLevel

type LogLevel int

LogLevel ...

const (
	// DebugLevel ...
	DebugLevel LogLevel = 3
	// InfoLevel ...
	InfoLevel LogLevel = 2
	// WarnLevel ...
	WarnLevel LogLevel = 1
	// ErrLevel ...
	ErrLevel LogLevel = 0
)

type Logger

type Logger interface {
	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warningf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
}

Logger interface used in this package.

func NewLogger

func NewLogger(lev LogLevel) Logger

NewLogger ...