datautils

package module
Version: v0.0.0-...-c946913 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2020 License: MIT Imports: 8 Imported by: 6

README

datautils

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchQuery

type BatchQuery struct {
	// contains filtered or unexported fields
}

BatchQuery - the BatchQuery struct

func NewBatchQuery

func NewBatchQuery(config *cfg.Configuration) *BatchQuery

NewBatchQuery - create a new BatchQuery object

func (*BatchQuery) Begin

func (m *BatchQuery) Begin()

Begin - begin a transaction

func (*BatchQuery) Commit

func (m *BatchQuery) Commit()

Commit - commit a transaction

func (*BatchQuery) Connect

func (m *BatchQuery) Connect(connectionID string) bool

Connect - connect the BatchQuery to the databse

func (*BatchQuery) Discard

func (m *BatchQuery) Discard(PointID string)

Discard - discard the save point data

func (*BatchQuery) Disconnect

func (m *BatchQuery) Disconnect()

Disconnect - disconnect from the dataabse

func (*BatchQuery) Do

func (m *BatchQuery) Do(preparedSQL string, args ...interface{}) QueryResult

Do - execute a stored procedure

func (*BatchQuery) Get

func (m *BatchQuery) Get(preparedSQL string, args ...interface{}) QueryResult

Get - get data from the database

func (*BatchQuery) LastActionNumber

func (m *BatchQuery) LastActionNumber() int

LastActionNumber - returns the last action number

func (*BatchQuery) LastErrorText

func (m *BatchQuery) LastErrorText() string

LastErrorText - returns the last error text

func (*BatchQuery) LastQuery

func (m *BatchQuery) LastQuery() string

LastQuery - returns the last query

func (*BatchQuery) LastScopeActionNumber

func (m *BatchQuery) LastScopeActionNumber() int

LastScopeActionNumber - returns the last scope action number

func (*BatchQuery) LastScopeName

func (m *BatchQuery) LastScopeName() string

LastScopeName - returns the name of the last scope

func (*BatchQuery) Mark

func (m *BatchQuery) Mark(PointID string)

Mark - mark the start of a save point

func (*BatchQuery) OK

func (m *BatchQuery) OK() bool

OK - checks if all queries are OK

func (*BatchQuery) Rollback

func (m *BatchQuery) Rollback()

Rollback - rollback a transaction

func (*BatchQuery) ScopeName

func (m *BatchQuery) ScopeName(scopeName string)

ScopeName - name of a function where this query is currently running for debugging purposes. This must be set before any query is executed. The default scope name is 'main'

func (*BatchQuery) Set

func (m *BatchQuery) Set(preparedSQL string, args ...interface{}) QueryResult

Set - set data in the database

func (*BatchQuery) Settings

func (m *BatchQuery) Settings() cfg.Configuration

Settings - returns the internal datahelper settings

func (*BatchQuery) Waive

func (m *BatchQuery) Waive()

Waive - resets the error message back to zero to allow sending query again

type DataConfiguration

type DataConfiguration struct {
	DataQuery                // DataQuery object
	Helper    *dh.DataHelper // DataHelper object
}

DataConfiguration - a configuration for import/export

func (*DataConfiguration) SetArgs

func (dc *DataConfiguration) SetArgs(args ...interface{})

SetArgs - set the arguments

type DataQuery

type DataQuery struct {
	PreparedQuery string        // A prepared SQL query
	Args          []interface{} // Value arguments
}

DataQuery - a data query set

type Importer

type Importer struct {
	ID               string            // ID of the Importer
	Source           DataConfiguration // Source data access configuration
	Destination      DataConfiguration // Destination data access
	DestinationCheck DataQuery         // A check query before importing data. If set, the importer will utilize this query
	Log              bool              // Log actions
	// contains filtered or unexported fields
}

Importer - imports data and store data to the destination

func (*Importer) Run

func (imp *Importer) Run() (selected int64, inserted int64, err error)

Run - run the importer

func (*Importer) SetCheckerIndex

func (imp *Importer) SetCheckerIndex(argindex ...int)

SetCheckerIndex - set the checker result index for the DestinationChecker

type QueryResult

type QueryResult struct {
	OK              bool
	Data            []dt.Row
	HasData         bool
	HasAffectedRows bool
}

QueryResult - the result of the query

func (*QueryResult) First

func (q *QueryResult) First() *dt.Row

First - shortcut to get the first row row

func (*QueryResult) Get

func (q *QueryResult) Get(rowIndex int) *dt.Row

Get - shortcut to get row

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL