Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrUnknownDriver database driver unknown ErrUnknownDriver = errors.New("database driver unknown") )
Functions ¶
This section is empty.
Types ¶
type Connection ¶
Connection represents the database Connection with gorm and holds other things like state and logger
func New ¶
func New(driver Driver, dsn string, logger log.Logger) *Connection
New returns a configured Connection object
func (*Connection) Close ¶
func (c *Connection) Close()
Close closing the connection to the database
func (*Connection) Driver ¶
func (c *Connection) Driver() Driver
Driver return Driver that used by database Connection
func (*Connection) Open ¶
func (c *Connection) Open() error
Open opens the connection to the database
func (*Connection) State ¶
func (c *Connection) State() State
State returns state of database Connection
type Driver ¶
type Driver string
Driver defines database Drivers
const ( // DriverMySQL means that database will use gorm mysql driver DriverMySQL Driver = "mysql" )
func ParseDriver ¶
ParseDriver takes a string driver and returns the Driver constant
type State ¶
type State string
State defines the status of the database Connection
const ( // StateCreated means Connection object is created StateCreated State = "created" // StateOpening means the Connection object start to connect to the database StateOpening State = "opening" // StateConnected means the Connection object is connection to the database StateConnected State = "connected" // StateClosing means the Connection object starts to close the connection to the database StateClosing State = "closing" // StateClosed means the Connection object is disconnected to the database StateClosed State = "closed" )
Click to show internal directories.
Click to hide internal directories.