Documentation ¶
Index ¶
- func AddStartWith(q firestore.Query, key string, word string) firestore.Query
- func CommitBulkWriter(ctx context.Context) (context.Context, error)
- func Create(ctx context.Context, colRef *firestore.CollectionRef, src any) error
- func Delete(ctx context.Context, docRef *firestore.DocumentRef) error
- func GenerateDocumentRef(cFirestore *firestore.Client, docRefs []*DocRef) *firestore.DocumentRef
- func Get(ctx context.Context, docRef *firestore.DocumentRef, dst any) (bool, error)
- func GetByQuery(ctx context.Context, query firestore.Query, dst any) (bool, error)
- func GetModelMapByBatchGetter[E, M any](bg TypedBatchGetter[E], getModel FuncGetModel[E, M]) map[string]*M
- func GetMulti(ctx context.Context, cFirestore *firestore.Client, ...) error
- func ListByQuery(ctx context.Context, query firestore.Query, dsts any) error
- func ListByQueryCursor(ctx context.Context, query firestore.Query, limit int, ...) (*firestore.DocumentSnapshot, error)
- func RunBulkWriter(ctx context.Context, cFirestore *firestore.Client) context.Context
- func RunTransaction(ctx context.Context, cFirestore *firestore.Client, ...) error
- func Set(ctx context.Context, docRef *firestore.DocumentRef, src any) error
- func SetDocByDst(dst any, ref *firestore.DocumentRef)
- func SetDocByDsts(rv reflect.Value, rt reflect.Type, ref *firestore.DocumentRef)
- func SetEmptyByMap(dst any)
- func SetEmptyByMaps(rv reflect.Value, rt reflect.Type)
- func SetEmptyBySlice(dst any)
- func SetEmptyBySlices(rv reflect.Value, rt reflect.Type)
- func Update(ctx context.Context, docRef *firestore.DocumentRef, kv map[string]any) error
- func ValidateCollectionRef(colRef *firestore.CollectionRef) bool
- func ValidateDocumentID(str string) bool
- func ValidateDocumentRef(docRef *firestore.DocumentRef) bool
- type BatchGetter
- type ConvertibleBatchGetter
- type ConvertibleBatchGetterItem
- type DocRef
- type FuncConvert
- type FuncGetDoc
- type FuncGetID
- type FuncGetModel
- type SummaryDocRef
- type TypedBatchGetter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddStartWith ¶
前方一致クエリを追加する
func CommitBulkWriter ¶ added in v1.5.0
func GenerateDocumentRef ¶
func GenerateDocumentRef(cFirestore *firestore.Client, docRefs []*DocRef) *firestore.DocumentRef
ドキュメント参照を作成する
func GetByQuery ¶
クエリで単体取得する(tx対応)
func GetModelMapByBatchGetter ¶ added in v1.5.6
func GetModelMapByBatchGetter[E, M any]( bg TypedBatchGetter[E], getModel FuncGetModel[E, M], ) map[string]*M
func GetMulti ¶
func GetMulti(ctx context.Context, cFirestore *firestore.Client, docRefs []*firestore.DocumentRef, dsts any) error
複数取得する(tx対応)
func ListByQuery ¶
クエリで複数取得する(tx対応)
func ListByQueryCursor ¶
func ListByQueryCursor(ctx context.Context, query firestore.Query, limit int, cursor *firestore.DocumentSnapshot, dsts any) (*firestore.DocumentSnapshot, error)
クエリで複数取得する(ページング)
func RunBulkWriter ¶ added in v1.5.0
func RunTransaction ¶ added in v1.0.6
func SetDocByDst ¶ added in v1.8.0
func SetDocByDst(dst any, ref *firestore.DocumentRef)
func SetDocByDsts ¶ added in v1.8.0
func SetEmptyByMap ¶ added in v1.8.0
func SetEmptyByMap(dst any)
func SetEmptyBySlice ¶ added in v1.8.0
func SetEmptyBySlice(dst any)
func ValidateCollectionRef ¶ added in v1.4.0
func ValidateCollectionRef(colRef *firestore.CollectionRef) bool
正常な Path かチェック
func ValidateDocumentID ¶ added in v1.4.0
正常な DocumentID かチェック
func ValidateDocumentRef ¶ added in v1.4.0
func ValidateDocumentRef(docRef *firestore.DocumentRef) bool
正常な Path かチェック
Types ¶
type BatchGetter ¶ added in v1.5.6
type BatchGetter interface { // Add ... 取得対象を追加 Add(docRef *firestore.DocumentRef, dst any) // Delete ... 取得対象を削除 Delete(docRef *firestore.DocumentRef) // Commit ... 取得処理を実行 Commit(ctx context.Context) error // IsCommittedItem ... 対象データがコミットが済んでいるかどうか IsCommittedItem(path string) bool // Get ... 対象データを取得 Get(path string) any // OnCommit ... Commit 後に実行されるコールバック関数を追加。 // このコールバック関数内で、Addをした場合は、再度コミットされます。(OnCommit も再度発火します。) OnCommit(func()) func() // OnEnd ... Commit 完了後に実行されるコールバック関数を追加。 // 最後に一度だけ実行されます。 OnEnd(func()) func() }
func NewBatchGetter ¶ added in v1.5.6
func NewBatchGetter(cFirestore *firestore.Client) BatchGetter
type ConvertibleBatchGetter ¶ added in v1.6.0
type ConvertibleBatchGetter[S, D any] interface { // Add ... 取得対象を追加 Add(ids ...string) ConvertibleBatchGetterItem[*D] // Delete ... 取得対象を削除 Delete(ids ...string) // GetMap ... 取得済みのデータをmapで取得 // map の key は doc の path になります。 GetMap() map[string]*D // Get ... 取得済みのデータを取得 Get(ids ...string) *D // Commit ... alias: bg の Commit を実行する Commit(ctx context.Context) error // Set ... 取得後に値を入れる変数を指定して取得対象を追加。 // 第二引数以降の ids は Add の引数から dst.ID を除いたものを指定する。 Set(dst *D, ids ...string) ConvertibleBatchGetterItem[*D] // SetWithID ... 取得後に値を入れる変数を指定して取得対象を追加。 // 第二引数以降の ids は Add の引数と同じ。 SetWithID(dst *D, ids ...string) ConvertibleBatchGetterItem[*D] }
func NewConvertibleBatchGetter ¶ added in v1.6.0
func NewConvertibleBatchGetter[S, D any]( bg BatchGetter, getDoc FuncGetDoc, getID FuncGetID[D], convert FuncConvert[S, D], ) ConvertibleBatchGetter[S, D]
type ConvertibleBatchGetterItem ¶ added in v1.6.0
type ConvertibleBatchGetterItem[D any] interface { // After ... 取得後に実行されるコールバック関数を追加(コールバック関数の第一引数に nil が入ることはありません)。 // After のコールバック関数内で Add した場合は、再度 Commit が実行されます。 After(func(D)) ConvertibleBatchGetterItem[D] // RemoveAfter ... After で登録したコールバック関数を削除 RemoveAfter() ConvertibleBatchGetterItem[D] // OnEmpty ... 取得後に nil だった場合に実行されるコールバック関数を追加。 // OnEmpty のコールバック関数内で Add した場合は、再度 Commit が実行されます。 OnEmpty(func()) ConvertibleBatchGetterItem[D] // RemoveOnEmpty ... OnEmpty で登録したコールバック関数を削除 RemoveOnEmpty() ConvertibleBatchGetterItem[D] }
type FuncConvert ¶ added in v1.6.0
type FuncConvert[S, D any] func(*S) *D
type FuncGetDoc ¶ added in v1.5.6
type FuncGetDoc func(ids ...string) *firestore.DocumentRef
type FuncGetModel ¶ added in v1.5.6
type SummaryDocRef ¶
最小のドキュメント参照(フロントに返せる)
func GenerateSummaryDocRef ¶
func GenerateSummaryDocRef(docRef *firestore.DocumentRef, rootCollectionPath string) *SummaryDocRef
最小のドキュメント参照を取得する
type TypedBatchGetter ¶ added in v1.5.6
type TypedBatchGetter[T any] interface { ConvertibleBatchGetter[T, T] }
func NewTypedBatchGetter ¶ added in v1.5.6
func NewTypedBatchGetter[T any]( bg BatchGetter, getDoc FuncGetDoc, getID FuncGetID[T], convert FuncConvert[T, T], ) TypedBatchGetter[T]
Click to show internal directories.
Click to hide internal directories.