Documentation
¶
Index ¶
- func AdminDatabaseEncryptedEntities(db DBFunc, mapper *gorpmapper.Mapper) service.Handler
- func AdminDatabaseEncryptedTuplesByEntity(db DBFunc, mapper *gorpmapper.Mapper) service.Handler
- func AdminDatabaseMigrationUnlocked(db DBFunc) service.Handler
- func AdminDatabaseRollEncryptedEntityByPrimaryKey(db DBFunc, mapper *gorpmapper.Mapper) service.Handler
- func AdminDatabaseSignatureResume(db DBFunc, mapper *gorpmapper.Mapper) service.Handler
- func AdminDatabaseSignatureRollEntityByPrimaryKey(db DBFunc, mapper *gorpmapper.Mapper) service.Handler
- func AdminDatabaseSignatureTuplesBySigner(db DBFunc, mapper *gorpmapper.Mapper) service.Handler
- func AdminDeleteDatabaseMigration(db DBFunc) service.Handler
- func AdminGetDatabaseMigration(db DBFunc) service.Handler
- func DBMap(m *gorpmapper.Mapper, db *sql.DB) *gorp.DbMap
- type DBConfiguration
- type DBConfigurationWithEncryption
- type DBConnectionFactory
- func (f *DBConnectionFactory) Close() error
- func (f *DBConnectionFactory) DB() *sql.DB
- func (f *DBConnectionFactory) GetDBMap(m *gorpmapper.Mapper) func() *gorp.DbMap
- func (f *DBConnectionFactory) NewListener(minReconnectInterval time.Duration, maxReconnectInterval time.Duration, ...) *pq.Listener
- func (f *DBConnectionFactory) Set(d *sql.DB)
- func (f *DBConnectionFactory) Status(ctx context.Context) sdk.MonitoringStatusLine
- type DBFunc
- type KeyConfig
- type RollingKeyConfig
- type TypeConverter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdminDatabaseEncryptedEntities ¶
func AdminDatabaseEncryptedEntities(db DBFunc, mapper *gorpmapper.Mapper) service.Handler
func AdminDatabaseEncryptedTuplesByEntity ¶
func AdminDatabaseEncryptedTuplesByEntity(db DBFunc, mapper *gorpmapper.Mapper) service.Handler
func AdminDatabaseRollEncryptedEntityByPrimaryKey ¶
func AdminDatabaseRollEncryptedEntityByPrimaryKey(db DBFunc, mapper *gorpmapper.Mapper) service.Handler
func AdminDatabaseSignatureResume ¶
func AdminDatabaseSignatureResume(db DBFunc, mapper *gorpmapper.Mapper) service.Handler
func AdminDatabaseSignatureRollEntityByPrimaryKey ¶
func AdminDatabaseSignatureRollEntityByPrimaryKey(db DBFunc, mapper *gorpmapper.Mapper) service.Handler
func AdminDatabaseSignatureTuplesBySigner ¶
func AdminDatabaseSignatureTuplesBySigner(db DBFunc, mapper *gorpmapper.Mapper) service.Handler
Types ¶
type DBConfiguration ¶
type DBConfiguration struct {
User string `toml:"user" default:"cds" json:"user"`
Role string `toml:"role" default:"" commented:"true" comment:"Set a specific role to run SET ROLE for each connection" json:"role"`
Password string `toml:"password" default:"cds" json:"-"`
Name string `toml:"name" default:"cds" json:"name"`
Schema string `toml:"schema" json:"schema"`
Host string `toml:"host" default:"localhost" json:"host"`
Port int `toml:"port" default:"5432" json:"port"`
SSLMode string `toml:"sslmode" default:"disable" comment:"DB SSL Mode: require (default), verify-full, or disable" json:"sslmode"`
MaxConn int `toml:"maxconn" default:"20" comment:"DB Max connection" json:"maxconn"`
ConnectTimeout int `toml:"connectTimeout" default:"10" comment:"Maximum wait for connection, in seconds" json:"connectTimeout"`
Timeout int `toml:"timeout" default:"3000" comment:"Statement timeout value in milliseconds" json:"timeout"`
}
DBConfiguration is the exposed type for database configuration that is used by migrate service.
type DBConfigurationWithEncryption ¶
type DBConfigurationWithEncryption struct {
User string `toml:"user" default:"cds" json:"user"`
Role string `toml:"role" default:"" commented:"true" comment:"Set a specific role to run SET ROLE for each connection" json:"role"`
Password string `toml:"password" default:"cds" json:"-"`
Name string `toml:"name" default:"cds" json:"name"`
Schema string `toml:"schema" json:"schema" comment:"Database schema name, default value is 'public'"`
Host string `toml:"host" default:"localhost" json:"host"`
Port int `toml:"port" default:"5432" json:"port"`
SSLMode string `toml:"sslmode" default:"disable" comment:"DB SSL Mode: require (default), verify-full, or disable" json:"sslmode"`
MaxConn int `toml:"maxconn" default:"20" comment:"DB Max connection" json:"maxconn"`
ConnectTimeout int `toml:"connectTimeout" default:"10" comment:"Maximum wait for connection, in seconds" json:"connectTimeout"`
Timeout int `toml:"timeout" default:"3000" comment:"Statement timeout value in milliseconds" json:"timeout"`
SignatureKey RollingKeyConfig `json:"-" toml:"signatureRollingKeys" comment:"Signature rolling keys" mapstructure:"signatureRollingKeys"`
EncryptionKey RollingKeyConfig `json:"-" toml:"encryptionRollingKeys" comment:"Encryption rolling keys" mapstructure:"encryptionRollingKeys"`
}
DBConfigurationWithEncryption is the exposed type for database configuration that requires encryption.
type DBConnectionFactory ¶
type DBConnectionFactory struct {
DBRole string
DBUser string
DBPassword string
DBName string
DBSchema string
DBHost string
DBPort int
DBSSLMode string
DBTimeout int
DBConnectTimeout int
DBMaxConn int
Database *sql.DB
// contains filtered or unexported fields
}
DBConnectionFactory is a database connection factory on postgres with gorp
func Init ¶
func Init(ctx context.Context, user, role, password, name, schema, host string, port int, sslmode string, connectTimeout, timeout, maxconn int) (*DBConnectionFactory, error)
Init initialize sql.DB object by checking environment variables and connecting to database
func (*DBConnectionFactory) Close ¶
func (f *DBConnectionFactory) Close() error
Close closes the database, releasing any open resources.
func (*DBConnectionFactory) DB ¶
func (f *DBConnectionFactory) DB() *sql.DB
DB returns the current sql.DB object
func (*DBConnectionFactory) GetDBMap ¶
func (f *DBConnectionFactory) GetDBMap(m *gorpmapper.Mapper) func() *gorp.DbMap
GetDBMap returns a gorp.DbMap pointer
func (*DBConnectionFactory) NewListener ¶
func (f *DBConnectionFactory) NewListener(minReconnectInterval time.Duration, maxReconnectInterval time.Duration, eventCallback pq.EventCallbackType) *pq.Listener
NewListener creates a new database connection dedicated to LISTEN / NOTIFY.
func (*DBConnectionFactory) Set ¶
func (f *DBConnectionFactory) Set(d *sql.DB)
Set is for tetsing purpose, we need to set manually the connection
func (*DBConnectionFactory) Status ¶
func (f *DBConnectionFactory) Status(ctx context.Context) sdk.MonitoringStatusLine
Status returns database driver and status in a printable string
type RollingKeyConfig ¶
type TypeConverter ¶
type TypeConverter struct{}
TypeConverter is a converter type to assign to gorp
func (*TypeConverter) FromDb ¶
func (c *TypeConverter) FromDb(target interface{}) (gorp.CustomScanner, bool)
FromDb is called by gorp to deserialize database values to custom types
func (*TypeConverter) ToDb ¶
func (c *TypeConverter) ToDb(val interface{}) (interface{}, error)
ToDb is called by gorp to serialize custom types to database values