Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrDBHostMandatory is the error that indicates that the DB host is mandatory, but has not been set. ErrDBHostMandatory = errors.New(`db host is mandatory`) // ErrDBPortMandatory is the error that indicates that the DB port is mandatory, but has not been set. ErrDBPortMandatory = errors.New(`db port is mandatory`) // ErrDBUserMandatory is the error that indicates that the DB user is mandatory, but has not been set. ErrDBUserMandatory = errors.New(`db user is mandatory`) // ErrDBNameMandatory is the error that indicates that the DB name is mandatory, but has not been set. ErrDBNameMandatory = errors.New(`db name is mandatory`) // ErrDBPasswordMandatory is the error that indicates that the DB password is mandatory, but has not been set. ErrDBPasswordMandatory = errors.New(`db password is mandatory`) )
Functions ¶
func Init ¶
Init runs the migrations, needed to have a working Gira DB. It gets the SQL files from the default `./sql` directory.
func InitFromDirectory ¶ added in v1.1.0
InitFromDirectory runs the migrations, needed to have a working Gira DB. It gets the SQL files from the provided directory.
func MigrationsDirectory ¶ added in v1.2.0
MigrationsDirectory returns the path to the directory containing the SQL migrations. It will return an absolute path that can be passed directly to `InitFromDirectory`.
Types ¶
type DBOptions ¶
DBOptions is the struct that encapsulates the fields needed to construct a database.
func (*DBOptions) ConnectionString ¶
ConnectionString returns a connection string build from the values of o. This method will call Validate beforehand, and will propagate any error returned from Validate. The connections string will be in the format of PostgresSQL.