Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateDB ¶
CreateDB creates a database with the given name. Note 1: When the DataSourceName already contained a database name but it doesn't exist yet (error 1049 occurred during Ping()), the same error will occur when trying to create the database. So this method is only useful when the DataSourceName did NOT contain a database name. Note 2: Prepared statements cannot be used for creating and using databases, so you must make sure that dbName doesn't contain SQL injections.
Types ¶
type Client ¶
type Client struct { C *sql.DB UpsertStmt *sql.Stmt GetStmt *sql.Stmt DeleteStmt *sql.Stmt Codec encoding.Codec }
Client is a gokv.Store implementation for SQL databases.
func (Client) Close ¶
Close closes the client. It must be called to return all open connections to the connection pool and to release any open resources.
func (Client) Delete ¶
Delete deletes the stored value for the given key. Deleting a non-existing key-value pair does NOT lead to an error. The key must not be "".
func (Client) Get ¶
Get retrieves the stored value for the given key. You need to pass a pointer to the value, so in case of a struct the automatic unmarshalling can populate the fields of the object that v points to with the values of the retrieved object's values. If no value is found it returns (false, nil). The key must not be "" and the pointer must not be nil.