Documentation ¶
Index ¶
- Constants
- type Config
- type InMemoryDBService
- func (dbs *InMemoryDBService) CreateOrUpdateSession(s session.Session) error
- func (dbs *InMemoryDBService) DeleteBuildAPICredentials(username string) error
- func (dbs *InMemoryDBService) DeleteSession(key string) error
- func (dbs *InMemoryDBService) FetchBuildAPICredentials(username string) ([]byte, error)
- func (dbs *InMemoryDBService) FetchSession(key string) (*session.Session, error)
- func (dbs *InMemoryDBService) StoreBuildAPICredentials(username string, credentials []byte) error
- type Service
- type SpannerConfig
- type SpannerDBService
- func (dbs *SpannerDBService) CreateOrUpdateSession(s session.Session) error
- func (dbs *SpannerDBService) DeleteBuildAPICredentials(username string) error
- func (dbs *SpannerDBService) DeleteSession(key string) error
- func (dbs *SpannerDBService) FetchBuildAPICredentials(username string) ([]byte, error)
- func (dbs *SpannerDBService) FetchSession(key string) (*session.Session, error)
- func (dbs *SpannerDBService) StoreBuildAPICredentials(username string, credentials []byte) error
Constants ¶
View Source
const InMemoryDBType = "InMemory"
View Source
const SpannerDBType = "Spanner"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Type string Spanner *SpannerConfig }
type InMemoryDBService ¶
type InMemoryDBService struct {
// contains filtered or unexported fields
}
Simple in memory database to use for testing or local development.
func NewInMemoryDBService ¶
func NewInMemoryDBService() *InMemoryDBService
func (*InMemoryDBService) CreateOrUpdateSession ¶
func (dbs *InMemoryDBService) CreateOrUpdateSession(s session.Session) error
func (*InMemoryDBService) DeleteBuildAPICredentials ¶
func (dbs *InMemoryDBService) DeleteBuildAPICredentials(username string) error
func (*InMemoryDBService) DeleteSession ¶
func (dbs *InMemoryDBService) DeleteSession(key string) error
func (*InMemoryDBService) FetchBuildAPICredentials ¶
func (dbs *InMemoryDBService) FetchBuildAPICredentials(username string) ([]byte, error)
func (*InMemoryDBService) FetchSession ¶
func (dbs *InMemoryDBService) FetchSession(key string) (*session.Session, error)
func (*InMemoryDBService) StoreBuildAPICredentials ¶
func (dbs *InMemoryDBService) StoreBuildAPICredentials(username string, credentials []byte) error
type Service ¶
type Service interface { // Credentials are usually stored encrypted hence the []byte type. // If no credentials are available for the given user Fetch returns nil, nil. FetchBuildAPICredentials(username string) ([]byte, error) // Store new credentials or overwrite existing ones for the given user. StoreBuildAPICredentials(username string, credentials []byte) error DeleteBuildAPICredentials(username string) error // Create or update a user session. CreateOrUpdateSession(s session.Session) error // Fetch a session. Returns nil, nil if the session doesn't exist. FetchSession(key string) (*session.Session, error) // Delete a session. Won't return error if the session doesn't exist. DeleteSession(key string) error }
type SpannerConfig ¶
type SpannerConfig struct {
DatabaseName string
}
type SpannerDBService ¶
type SpannerDBService struct {
// contains filtered or unexported fields
}
A database service that works with a Cloud Spanner database with the following schema:
table Credentials { username string primary key credentials byte array # wide enough to store an encrypted JSON-serialized oauth2.Token object } table Sessions { session_key string primary key oauth2_state string accessed_at timestamp }
func NewSpannerDBService ¶
func NewSpannerDBService(db string) *SpannerDBService
func (*SpannerDBService) CreateOrUpdateSession ¶
func (dbs *SpannerDBService) CreateOrUpdateSession(s session.Session) error
func (*SpannerDBService) DeleteBuildAPICredentials ¶
func (dbs *SpannerDBService) DeleteBuildAPICredentials(username string) error
func (*SpannerDBService) DeleteSession ¶
func (dbs *SpannerDBService) DeleteSession(key string) error
func (*SpannerDBService) FetchBuildAPICredentials ¶
func (dbs *SpannerDBService) FetchBuildAPICredentials(username string) ([]byte, error)
func (*SpannerDBService) FetchSession ¶
func (dbs *SpannerDBService) FetchSession(key string) (*session.Session, error)
func (*SpannerDBService) StoreBuildAPICredentials ¶
func (dbs *SpannerDBService) StoreBuildAPICredentials(username string, credentials []byte) error
Click to show internal directories.
Click to hide internal directories.