Documentation ¶
Index ¶
- Constants
- Variables
- func ErrorIsAlreadyExists(err error) bool
- func ErrorIsCanceled(err error) bool
- func ErrorIsNotFound(err error) bool
- type CollectionIterator
- type DBCollectionChanges
- type DBConnection
- func (db *DBConnection) Add(ctx context.Context, docname string, dval interface{}) error
- func (db *DBConnection) AddOrReplace(ctx context.Context, docname string, dval interface{}) error
- func (db *DBConnection) AtomicGetOrCreate(ctx context.Context, docname string, dval interface{}, createfunc DBCreateFunc) error
- func (db *DBConnection) AtomicUpdate(ctx context.Context, docname string, dval interface{}, updateFunc DBUpdateFunc) error
- func (db *DBConnection) CollectionGroupAdd(ctx context.Context, colname string, dval interface{}) error
- func (db *DBConnection) CollectionGroupQuery(ctx context.Context, colname string, wheres []*DbWhere) *DocumentIterator
- func (db *DBConnection) CollectionIterator(ctx context.Context, docname string) *CollectionIterator
- func (db *DBConnection) CollectionListen(log logger.CompatLogWriter, ctx context.Context, collection string, ...) error
- func (db *DBConnection) Delete(ctx context.Context, docname string) error
- func (db *DBConnection) DocListen(ctx context.Context, collection string, doc string, ...) error
- func (db *DBConnection) DocumentIterator(ctx context.Context, path string) *DocumentIterator
- func (db *DBConnection) Escape(raw string) string
- func (db *DBConnection) Get(ctx context.Context, docname string, dval interface{}) error
- func (db *DBConnection) NextDoc(ctx context.Context, iter *DocumentIterator, dval interface{}) error
- func (db *DBConnection) NextDocPath(ctx context.Context, iter *DocumentIterator, dval interface{}) (string, error)
- func (db *DBConnection) QueryIterator(ctx context.Context, colname string, attr string, comparison string, ...) *DocumentIterator
- func (db *DBConnection) RunTransaction(ctx context.Context, tfuncs ...TransactionFunc) error
- func (db *DBConnection) Unescape(s string) string
- type DBCreateFunc
- type DBUpdateFunc
- type DbWhere
- type DocumentChange
- type DocumentChangeKind
- type DocumentIterator
- type JoinCode
- func JoinCodeCreate(mgrid string, t *Transaction, uid string, data map[string]any) (*JoinCode, error)
- func JoinCodeLookupByCode(t *Transaction, code string) (*JoinCode, error)
- func JoinCodeLookupByUID(mgrid string, t *Transaction, uid string) (*JoinCode, error)
- func ListJoinCodes(t *Transaction) ([]*JoinCode, error)
- type ListenFilter
- type Transaction
- func (t *Transaction) Add(docname string, dval interface{}) error
- func (t *Transaction) AddOrReplace(docname string, dval interface{}) error
- func (t *Transaction) Delete(docname string) error
- func (t *Transaction) DocumentIterator(colname string) *DocumentIterator
- func (t *Transaction) Escape(raw string) string
- func (t *Transaction) Get(docname string, dval interface{}) error
- func (t *Transaction) NextDocPath(iter *DocumentIterator, dval interface{}) (string, error)
- func (t *Transaction) QueryIterator(colname string, attr string, comparison string, val string) *DocumentIterator
- type TransactionFunc
Constants ¶
View Source
const ( JoinCodeLength = 6 JoinCodeCharacters = "0123456789" )
Variables ¶
View Source
var DBIteratorDone = iterator.Done
Functions ¶
func ErrorIsAlreadyExists ¶
func ErrorIsCanceled ¶
func ErrorIsNotFound ¶
Types ¶
type CollectionIterator ¶
type CollectionIterator struct {
*firestore.CollectionIterator
}
type DBCollectionChanges ¶
type DBCollectionChanges struct {
// contains filtered or unexported fields
}
func (*DBCollectionChanges) Changes ¶
func (c *DBCollectionChanges) Changes() []*DocumentChange
func (*DBCollectionChanges) Iterator ¶
func (c *DBCollectionChanges) Iterator() *DocumentIterator
type DBConnection ¶
func NewDBConnection ¶
func NewDBConnection(ctx context.Context, log logger.CompatLogWriter, project string, credentialsFile string) (*DBConnection, error)
func (*DBConnection) Add ¶
func (db *DBConnection) Add(ctx context.Context, docname string, dval interface{}) error
func (*DBConnection) AddOrReplace ¶
func (db *DBConnection) AddOrReplace(ctx context.Context, docname string, dval interface{}) error
func (*DBConnection) AtomicGetOrCreate ¶
func (db *DBConnection) AtomicGetOrCreate(ctx context.Context, docname string, dval interface{}, createfunc DBCreateFunc) error
func (*DBConnection) AtomicUpdate ¶
func (db *DBConnection) AtomicUpdate(ctx context.Context, docname string, dval interface{}, updateFunc DBUpdateFunc) error
func (*DBConnection) CollectionGroupAdd ¶
func (db *DBConnection) CollectionGroupAdd(ctx context.Context, colname string, dval interface{}) error
* Adds a new [automatically named] document to a collection group
func (*DBConnection) CollectionGroupQuery ¶
func (db *DBConnection) CollectionGroupQuery(ctx context.Context, colname string, wheres []*DbWhere) *DocumentIterator
func (*DBConnection) CollectionIterator ¶
func (db *DBConnection) CollectionIterator(ctx context.Context, docname string) *CollectionIterator
func (*DBConnection) CollectionListen ¶
func (db *DBConnection) CollectionListen(log logger.CompatLogWriter, ctx context.Context, collection string, handler func(changes *DBCollectionChanges) error, filter *ListenFilter) error
func (*DBConnection) Delete ¶
func (db *DBConnection) Delete(ctx context.Context, docname string) error
func (*DBConnection) DocListen ¶
func (db *DBConnection) DocListen(ctx context.Context, collection string, doc string, handler func(change *DocumentChange) error) error
func (*DBConnection) DocumentIterator ¶
func (db *DBConnection) DocumentIterator(ctx context.Context, path string) *DocumentIterator
func (*DBConnection) Escape ¶
func (db *DBConnection) Escape(raw string) string
func (*DBConnection) Get ¶
func (db *DBConnection) Get(ctx context.Context, docname string, dval interface{}) error
func (*DBConnection) NextDoc ¶
func (db *DBConnection) NextDoc(ctx context.Context, iter *DocumentIterator, dval interface{}) error
func (*DBConnection) NextDocPath ¶
func (db *DBConnection) NextDocPath(ctx context.Context, iter *DocumentIterator, dval interface{}) (string, error)
func (*DBConnection) QueryIterator ¶
func (db *DBConnection) QueryIterator(ctx context.Context, colname string, attr string, comparison string, val string) *DocumentIterator
func (*DBConnection) RunTransaction ¶
func (db *DBConnection) RunTransaction(ctx context.Context, tfuncs ...TransactionFunc) error
func (*DBConnection) Unescape ¶
func (db *DBConnection) Unescape(s string) string
type DBCreateFunc ¶
type DBUpdateFunc ¶
type DocumentChange ¶
type DocumentChange struct { Kind DocumentChangeKind Path string // contains filtered or unexported fields }
func (*DocumentChange) Data ¶
func (dc *DocumentChange) Data() map[string]interface{}
func (*DocumentChange) DataTo ¶
func (dc *DocumentChange) DataTo(dval interface{}) error
type DocumentChangeKind ¶
type DocumentChangeKind int
const ( DBCHANGE_ERROR DocumentChangeKind = iota DBCHANGE_DOC_ADDED DBCHANGE_DOC_REMOVED DBCHANGE_DOC_CHANGED )
func (DocumentChangeKind) ToString ¶
func (k DocumentChangeKind) ToString() string
type DocumentIterator ¶
type DocumentIterator struct {
*firestore.DocumentIterator
}
type JoinCode ¶
func JoinCodeCreate ¶
func JoinCodeLookupByCode ¶
func JoinCodeLookupByCode(t *Transaction, code string) (*JoinCode, error)
func JoinCodeLookupByUID ¶
func JoinCodeLookupByUID(mgrid string, t *Transaction, uid string) (*JoinCode, error)
func ListJoinCodes ¶
func ListJoinCodes(t *Transaction) ([]*JoinCode, error)
func (*JoinCode) Delete ¶
func (jc *JoinCode) Delete(t *Transaction) error
func (*JoinCode) Save ¶
func (jc *JoinCode) Save(t *Transaction) error
type ListenFilter ¶
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
func (*Transaction) Add ¶
func (t *Transaction) Add(docname string, dval interface{}) error
func (*Transaction) AddOrReplace ¶
func (t *Transaction) AddOrReplace(docname string, dval interface{}) error
func (*Transaction) Delete ¶
func (t *Transaction) Delete(docname string) error
func (*Transaction) DocumentIterator ¶
func (t *Transaction) DocumentIterator(colname string) *DocumentIterator
func (*Transaction) Escape ¶
func (t *Transaction) Escape(raw string) string
func (*Transaction) Get ¶
func (t *Transaction) Get(docname string, dval interface{}) error
func (*Transaction) NextDocPath ¶
func (t *Transaction) NextDocPath(iter *DocumentIterator, dval interface{}) (string, error)
func (*Transaction) QueryIterator ¶
func (t *Transaction) QueryIterator(colname string, attr string, comparison string, val string) *DocumentIterator
type TransactionFunc ¶
type TransactionFunc func(ctx context.Context, t *Transaction) error
Click to show internal directories.
Click to hide internal directories.