Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNoActiveConnection defines the error when an action wants to be performed // but no connection to the database is active ErrNoActiveConnection = errors.New("there is not active connection") // ErrRecordNotFound defines the error when there was an attempt to fetch/update/replace // a record but the record was not found ErrRecordNotFound = errors.New("record not found") // ErrRecordNotUpdated defines the error when there was an attempt to update/replace // a record but the action was not successful ErrRecordNotUpdated = errors.New("record not updated") // ErrRecordNotDeleted defines the error when there was an attempt to delete // a record but the action was not successful ErrRecordNotDeleted = errors.New("record not deleted") )
Functions ¶
This section is empty.
Types ¶
type DatabaseClient ¶
type DatabaseClient interface { // Disconnect performs any action to proper connect // and create a connection with the database Connect(context.Context, time.Duration) error // Disconnect performs any action to proper disconnect // and close any connection with the database Disconnect(context.Context) error // DeleteOne deletes a single record in database DeleteOne( context.Context, string, query.QueryBuilder, ) error // Find returns multiple records from the database Find( context.Context, string, query.QueryBuilder, interface{}, ) error // FindOne fetches a single record in database FindOne( context.Context, string, query.QueryBuilder, interface{}, ) error // InsertOne stores a single record // in the specified table/collection // and returns the id of the stored record InsertOne( context.Context, string, interface{}, ) (string, error) // UpdateOne updates a single record in database UpdateOne( context.Context, string, query.QueryBuilder, interface{}, ) error }
DatabaseClient defines a handler to manage actions against databases
type DatabaseConfiguration ¶
DatabaseConfiguration defines all the parameters needed to proper configure a connection to a database
Click to show internal directories.
Click to hide internal directories.