Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Database ¶
type Database interface { // Open returns a new database instance configured with parameters // coming from the URL string. Open(url string, subdir string) (Database, error) // Close closes the underlying instance managed by the database. Close() error // Get reads the contents of a file or resource by name. // If there is no file available, it must return os.ErrNotExist. Get(file string) (contents string, err error) // Set writes the contents to a file or resource. Set(file string, contents string) error // Path get the full path of the database Path() (path string) }
Database is the interface every database must implement.
How to implement?
- Implement this interface.
- Add a test that calls database/testing.go:Test()
- Add own tests for Open() and Close(). All other functions are tested by tests in database/testing. Saves you some time and makes sure all databases behave the same way.
- Call Register in init().
Guidelines:
- All configuration input must come from the URL string in func Open()
- Drivers are supposed to be read only.
- Ideally don't load any contents (into memory) in Open
Click to show internal directories.
Click to hide internal directories.