cloudfirestore

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 License: MIT Imports: 14 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddStartWith

func AddStartWith(q firestore.Query, key string, word string) firestore.Query

AddStartWith ... 前方一致クエリを追加する

func CommitWriteBatch added in v1.0.6

func CommitWriteBatch(ctx context.Context) (context.Context, error)

func Create

func Create(ctx context.Context, colRef *firestore.CollectionRef, src interface{}) error

Create ... 作成する(tx, bt対応)

func Delete

func Delete(ctx context.Context, docRef *firestore.DocumentRef) error

Delete ... 削除する(tx, bt対応)

func GenerateDocumentRef

func GenerateDocumentRef(client *firestore.Client, docRefs []*DocRef) *firestore.DocumentRef

GenerateDocumentRef ... ドキュメント参照を作成する

func Get

func Get(ctx context.Context, docRef *firestore.DocumentRef, dst interface{}) (bool, error)

Get ... 単体取得する(tx対応)

func GetByQuery

func GetByQuery(ctx context.Context, query firestore.Query, dst interface{}) (bool, error)

GetByQuery ... クエリで単体取得する(tx対応)

func GetMulti

func GetMulti(ctx context.Context, client *firestore.Client, docRefs []*firestore.DocumentRef, dsts interface{}) error

GetMulti ... 複数取得する(tx対応)

func ListByQuery

func ListByQuery(ctx context.Context, query firestore.Query, dsts interface{}) error

ListByQuery ... クエリで複数取得する

func ListByQueryCursor

func ListByQueryCursor(ctx context.Context, query firestore.Query, limit int, cursor *firestore.DocumentSnapshot, dsts interface{}) (*firestore.DocumentSnapshot, error)

ListByQueryCursor ... クエリで複数取得する(ページング)

func NewClient

func NewClient(projectID string) *firestore.Client

NewClient ... Firestoreのクライアントを取得する

func RunTransaction added in v1.0.6

func RunTransaction(ctx context.Context, client *firestore.Client, fn func(ctx context.Context) error, opts ...firestore.TransactionOption) error

func RunWriteBatch added in v1.0.6

func RunWriteBatch(ctx context.Context, client *firestore.Client) context.Context

func Set

func Set(ctx context.Context, docRef *firestore.DocumentRef, src interface{}) error

Set ... 上書きする(tx, bt対応)

func Update

func Update(ctx context.Context, docRef *firestore.DocumentRef, kv map[string]interface{}) error

Update ... 更新する(tx, bt対応)

Types

type DocRef

type DocRef struct {
	CollectionName string `json:"collection_name"`
	DocID          string `json:"doc_id"`
}

DocRef ... 個別のドキュメント参照

type SummaryDocRef

type SummaryDocRef struct {
	ID   string `json:"id"`
	Path string `json:"path"`
}

SummaryDocRef ... 最小のドキュメント参照(フロントに返せる)

func GenerateSummaryDocRef

func GenerateSummaryDocRef(docRef *firestore.DocumentRef, rootCollectionPath string) *SummaryDocRef

GenerateSummaryDocRef ... 最小のドキュメント参照を取得する

Jump to

Keyboard shortcuts

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