bookshelf

package
v0.0.0-...-e2a45c9 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DB                BookDatabase
	OAuthConfig       *oauth2.Config
	PubsubClient      *pubsub.Client
	SessionStore      sessions.Store
	StorageBucket     *storage.BucketHandle
	StorageBucketName string
)
View Source
var (
	ProjectID         string = "rw-bookshelf"
	SQLUser           string = strings.TrimSuffix(os.Getenv("DB_USER"), "\n")
	SQLPassword       string = strings.TrimSuffix(os.Getenv("DB_PASSWORD"), "\n")
	SQLInstance       string = "rw-bookshelf:us-west1:library"
	OAuthClientID     string = strings.TrimSuffix(os.Getenv("OAUTH"), "\n")
	OAuthClientSecret string = strings.TrimSuffix(os.Getenv("SECRET"), "\n")
	GCSBucketName     string = "rw-bookshelf-library"
	CookieSecret      string = "something-secret"

	PubsubTopicID string = "fill-book-details"
)

Functions

This section is empty.

Types

type Book

type Book struct {
	ID       int64
	Title    string
	Author   string
	ImageURL string
}

Book holds metadata about a book

func (*Book) String

func (b *Book) String() string

type BookDatabase

type BookDatabase interface {
	// ListBooks returns a list of books, ordered by title
	ListBooks() ([]*Book, error)

	// GetBook retrieves a book by its ID
	GetBook(id int64) (*Book, error)

	// AddBook saves a given book, assigning it a new ID
	AddBook(b *Book) (id int64, err error)

	// DeleteBook removes a given book by its ID
	DeleteBook(id int64) error

	// UpdateBook updates the entry for a given book
	UpdateBook(b *Book) error

	// Close closes the database, freeing up resources
	Close()
}

BookDatabase provides thread-safe access to a database of books.

type MySQLConfig

type MySQLConfig struct {
	// Optional.
	Username, Password string

	// Host of the MySQL instance.
	//
	// If set, UnixSocket shoud be unset.
	Host string

	// Port of the MySQL instance.
	//
	// If set, UnixSocket should be unset.
	Port int

	// UnixSocket is the filepath to a unix socket.
	//
	// If set, Host and Port should be unset.
	UnixSocket string
}

Directories

Path Synopsis
Worker demonstrates the use of the Cloud Pub/Sub API
Worker demonstrates the use of the Cloud Pub/Sub API

Jump to

Keyboard shortcuts

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