firestore

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package firestore implements the storage interface using Google Cloud Firestore.

Index

Constants

View Source
const (
	// CollectionPosts is the name of the collection for posts.
	CollectionPosts = "posts"
	// CollectionAssets is the name of the collection for assets.
	CollectionAssets = "assets"
)

Variables

View Source
var (
	// ErrTitleEmpty is returned when the title is empty
	ErrTitleEmpty = fmt.Errorf("%w: title cannot be empty", storage.ErrInvalidArgument)
	// ErrAuthorMissing is returned when the author is missing
	ErrAuthorMissing = fmt.Errorf("%w: author cannot be empty", storage.ErrInvalidArgument)
	// ErrIDMissing is returned when the ID is missing
	ErrIDMissing = fmt.Errorf("%w: id cannot be empty", storage.ErrInvalidArgument)
	// ErrVersionMissing is returned when the version is missing
	ErrVersionMissing = fmt.Errorf("%w: version cannot be empty", storage.ErrInvalidArgument)

	// ErrContentTypeEmpty is returned when the content type is empty
	ErrContentTypeEmpty = fmt.Errorf("%w: content type cannot be empty", storage.ErrInvalidArgument)
	// ErrFileNameMissing is returned when the file name is missing
	ErrFileNameMissing = fmt.Errorf("%w: file name cannot be empty", storage.ErrInvalidArgument)
)

Functions

func New

func New(db *gcpfirestore.Client, opt ...Opt) storage.DataStore

New creates a new Firestore store.

Types

type Opt

type Opt func(*store)

Opt is a functional option for configuring a Firestore store.

func WithLogger

func WithLogger(l *zap.Logger) Opt

WithLogger sets the logger for the store.

Jump to

Keyboard shortcuts

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