Documentation
¶
Index ¶
- type DataHelper
- func (dh *DataHelper) Begin(intr bool) (*sql.Tx, error)
- func (dh *DataHelper) Commit(intr bool) error
- func (dh *DataHelper) Connect(ConnectionID ...string) (connected bool, err error)
- func (dh *DataHelper) ConnectionString() string
- func (dh *DataHelper) Discard(PointID string) error
- func (dh *DataHelper) Disconnect(intr bool) error
- func (dh *DataHelper) Exec(preparedQuery string, arg ...interface{}) (sql.Result, error)
- func (dh *DataHelper) Exists(tableNameWithParameters string, args ...interface{}) (bool, error)
- func (dh *DataHelper) GetData(preparedQuery string, arg ...interface{}) (*datatable.DataTable, error)
- func (dh *DataHelper) GetDataReader(preparedQuery string, arg ...interface{}) (datatable.Row, error)
- func (dh *DataHelper) GetRow(columns []string, tableNameWithParameters string, args ...interface{}) (SingleRow, error)
- func (dh *DataHelper) GetSequence(SequenceKey string) (string, error)
- func (dh *DataHelper) IsInTransaction() bool
- func (dh *DataHelper) Mark(PointID string) error
- func (dh *DataHelper) Prepare(preparedQuery string) (*sql.Stmt, error)
- func (dh *DataHelper) Rollback(intr bool) error
- func (dh *DataHelper) SetConnMaxLifetime(d time.Duration)
- func (dh *DataHelper) SetMaxIdleConnection(max int)
- func (dh *DataHelper) SetMaxOpenConns(max int)
- type ReadType
- type RowLimitPlacement
- type RowLimiting
- type SingleRow
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataHelper ¶
type DataHelper struct {
DriverName string // Driver name set in the configuration file
ConnectionID string // Connection ID set in the configuration file
AllQueryOK bool // Flags if all queries are ok in a non-transaction mode
Errors []string // Errors encountered
Settings cfg.Configuration // Settings from the configuration
CurrentDatabaseInfo *cfg.DatabaseInfo // Current database information
RowLimitInfo RowLimiting // Row limiting information
// contains filtered or unexported fields
}
DataHelper struct
func NewConnected ¶
func NewConnected(dh *DataHelper, config *cfg.Configuration, ConnectionID ...string) (*DataHelper, bool, error)
NewConnected creates a new connected datahelper. The dh parameter could optionally be supplied by a valid datahelper. Returns : DataHelper, InTransaction and Error
func NewDataHelper ¶
func NewDataHelper(config *cfg.Configuration) *DataHelper
NewDataHelper - creates a new DataHelper
func (*DataHelper) Begin ¶
func (dh *DataHelper) Begin(intr bool) (*sql.Tx, error)
Begin - begins a new transaction
func (*DataHelper) Commit ¶
func (dh *DataHelper) Commit(intr bool) error
Commit - commits a transaction
func (*DataHelper) Connect ¶
func (dh *DataHelper) Connect(ConnectionID ...string) (connected bool, err error)
Connect - connect to the database from configuration set in the NewDataHelper constructor.
func (*DataHelper) ConnectionString ¶
func (dh *DataHelper) ConnectionString() string
ConnectionString - get the current connection string
func (*DataHelper) Discard ¶
func (dh *DataHelper) Discard(PointID string) error
Discard - rejects a named transaction to simulate a save point
func (*DataHelper) Disconnect ¶
func (dh *DataHelper) Disconnect(intr bool) error
Disconnect - disconnect from the database
func (*DataHelper) Exec ¶
func (dh *DataHelper) Exec(preparedQuery string, arg ...interface{}) (sql.Result, error)
Exec - execute queries that does not return rows such us INSERT, DELETE and UPDATE
func (*DataHelper) Exists ¶
func (dh *DataHelper) Exists(tableNameWithParameters string, args ...interface{}) (bool, error)
Exists - checks if the record exists
func (*DataHelper) GetData ¶
func (dh *DataHelper) GetData(preparedQuery string, arg ...interface{}) (*datatable.DataTable, error)
GetData - get data from the database and return in a tabular form
func (*DataHelper) GetDataReader ¶
func (dh *DataHelper) GetDataReader(preparedQuery string, arg ...interface{}) (datatable.Row, error)
GetDataReader - returns a DataTable Row with an internal sql.Row object for iteration.
func (*DataHelper) GetRow ¶
func (dh *DataHelper) GetRow(columns []string, tableNameWithParameters string, args ...interface{}) (SingleRow, error)
GetRow - get a single row result from a query
func (*DataHelper) GetSequence ¶
func (dh *DataHelper) GetSequence(SequenceKey string) (string, error)
GetSequence - get the next sequence based on the sequence key
func (*DataHelper) IsInTransaction ¶
func (dh *DataHelper) IsInTransaction() bool
IsInTransaction - checks whether the database is in transaction
func (*DataHelper) Mark ¶
func (dh *DataHelper) Mark(PointID string) error
Mark - starts a named transaction to simulate a save point
func (*DataHelper) Prepare ¶
func (dh *DataHelper) Prepare(preparedQuery string) (*sql.Stmt, error)
Prepare - prepare a statement
func (*DataHelper) Rollback ¶
func (dh *DataHelper) Rollback(intr bool) error
Rollback - rollbacks a transaction
func (*DataHelper) SetConnMaxLifetime ¶
func (dh *DataHelper) SetConnMaxLifetime(d time.Duration)
SetConnMaxLifetime - connection maximum lifetime
func (*DataHelper) SetMaxIdleConnection ¶
func (dh *DataHelper) SetMaxIdleConnection(max int)
SetMaxIdleConnection - max idle connection
func (*DataHelper) SetMaxOpenConns ¶
func (dh *DataHelper) SetMaxOpenConns(max int)
SetMaxOpenConns - max open connection
type RowLimitPlacement ¶
type RowLimitPlacement int
RowLimitPlacement - row limit placement of row limits
const ( RowLimitingFront RowLimitPlacement = 0 // The database query puts row limiting inside the SELECT clause RowLimitingRear RowLimitPlacement = 1 // The database query puts row limiting at the end of the SELECT clause )
Constants
type RowLimiting ¶
type RowLimiting struct {
Keyword string
Placement RowLimitPlacement
}
RowLimiting - row limiting setup