Documentation ¶
Index ¶
Constants ¶
const ( // DialectMySQL defines the value to be used to identify a // MySQL dialect. DialectMySQL = "mysql" // DialectSqlite defines the value to be used to identify a // Sqlite dialect. DialectSqlite = "sqlite" )
Variables ¶
var ( // ErrNilPointer defines a nil pointer argument error ErrNilPointer = fmt.Errorf("invalid nil pointer") // ErrConversion defines a type conversion error ErrConversion = fmt.Errorf("invalid type conversion") // ErrConfigNotFound @todo doc ErrConfigNotFound = fmt.Errorf("rdb config not found") // ErrUnknownDialect @todo doc ErrUnknownDialect = fmt.Errorf("unknown rdb dialect") )
var ( // ConnectionsConfigPath contains the configuration path that holds the // relational database connection configurations. ConnectionsConfigPath = genv.String("GRDB_CONNECTIONS_CONFIG_PATH", "rdb.connections") // ObserveConfig defines the connection factory config observing flag // used to register in the config object an observer of the connection // config entries list, so it can reset the connections pool. ObserveConfig = genv.Bool("GRDB_OBSERVE_CONFIG", true) )
Functions ¶
This section is empty.
Types ¶
type ConnectionFactory ¶
type ConnectionFactory struct {
// contains filtered or unexported fields
}
ConnectionFactory @todo doc
func NewConnectionFactory ¶
func NewConnectionFactory(config gconfig.Manager, dialectFactory *DialectFactory) (*ConnectionFactory, error)
NewConnectionFactory instantiates a new connection factory instance.
type DialectFactory ¶
type DialectFactory []DialectStrategy
DialectFactory @todo doc
func (DialectFactory) Get ¶
Get generates a new connection dialect interface defined by the configuration parameters stored in the configuration partial marked by the given name.
func (*DialectFactory) Register ¶
func (f *DialectFactory) Register(strategy DialectStrategy) error
Register will register a new dialect factory strategy to be used on requesting to create a dialect.
type DialectStrategy ¶
type DialectStrategy interface { Accept(dialect string) bool Get(config gconfig.Config) (gorm.Dialector, error) }
DialectStrategy defines the interface to a gorm rdb dialect instantiation strategy, based on a configuration.
type DialectStrategyMySQL ¶
type DialectStrategyMySQL struct{}
DialectStrategyMySQL @todo doc
func (DialectStrategyMySQL) Accept ¶
func (DialectStrategyMySQL) Accept(dialect string) bool
Accept check if the provided configuration should the handled as a mysql connection definition,
type DialectStrategySqlite ¶
type DialectStrategySqlite struct{}
DialectStrategySqlite @todo doc
func (DialectStrategySqlite) Accept ¶
func (DialectStrategySqlite) Accept(name string) bool
Accept check if the provided configuration should the handled as a mysql connection definition,