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 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
}
Click to show internal directories.
Click to hide internal directories.