Skip to content

Commit

Permalink
add firestore struct
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobmichels committed Sep 1, 2022
1 parent 1d70651 commit 5d4381d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions internal/database/firestore.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package database

import (
"context"

"cloud.google.com/go/firestore"
)

type FirestoreDatabase struct {
client *firestore.Client
}

func NewFirestoreClient(ctx context.Context, projectID string) (*FirestoreDatabase, error) {
client, err := firestore.NewClient(ctx, projectID)
if err != nil {
return nil, err
}

return &FirestoreDatabase{client}, nil
}

func (fd *FirestoreDatabase) Close() error {
return fd.client.Close()
}

0 comments on commit 5d4381d

Please sign in to comment.