Documentation ¶
Index ¶
- func RegisterDatabase(ctx context.Context, scheme string, init_func DatabaseInitializationFunc) error
- func Schemes() []string
- type Database
- type DatabaseInitializationFunc
- type DocstoreDatabase
- func (db *DocstoreDatabase) AddURI(ctx context.Context, u *uri.URI) error
- func (db *DocstoreDatabase) GetURIWithShortURL(ctx context.Context, short_url string) (*uri.URI, error)
- func (db *DocstoreDatabase) GetURIWithSourceURL(ctx context.Context, source_url string) (*uri.URI, error)
- func (db *DocstoreDatabase) SetLogger(ctx context.Context, logger *log.Logger) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterDatabase ¶
func RegisterDatabase(ctx context.Context, scheme string, init_func DatabaseInitializationFunc) error
RegisterDatabase registers 'scheme' as a key pointing to 'init_func' in an internal lookup table used to create new `Database` instances by the `NewDatabase` method.
Types ¶
type Database ¶
type Database interface { AddURI(context.Context, *uri.URI) error GetURIWithSourceURL(context.Context, string) (*uri.URI, error) GetURIWithShortURL(context.Context, string) (*uri.URI, error) SetLogger(context.Context, *log.Logger) error }
func NewDatabase ¶
NewDatabase returns a new `Database` instance configured by 'uri'. The value of 'uri' is parsed as a `url.URL` and its scheme is used as the key for a corresponding `DatabaseInitializationFunc` function used to instantiate the new `Database`. It is assumed that the scheme (and initialization function) have been registered by the `RegisterDatabase` method.
type DatabaseInitializationFunc ¶
DatabaseInitializationFunc is a function defined by individual database package and used to create an instance of that database
type DocstoreDatabase ¶
type DocstoreDatabase struct { Database // contains filtered or unexported fields }