Documentation ¶
Index ¶
- Constants
- Variables
- func GetDefaultSeparatorForOutputFormat(Format int) (string, error)
- func GetOutputFormatFromString(Format string) (int, error)
- func ParseTlsString(tlsconf string) (secure bool, tlsInsecureSkipVerify bool, pem string)
- func SQCloudEnquoteString(s string) string
- type Chunk
- type Result
- func (this *Result) Dump()
- func (this *Result) DumpToScreen(MaxLineLength uint)
- func (this *Result) DumpToWriter(Out *bufio.Writer, Format int, NoHeader bool, Separator string, ...) (int, error)
- func (this *Result) Free()
- func (this *Result) GetBuffer() []byte
- func (this *Result) GetBufferLength() (uint64, error)
- func (this *Result) GetError() (int, int, int, string, error)
- func (this *Result) GetErrorAsString() string
- func (this *Result) GetError_() (int, string)
- func (this *Result) GetFirstRow() (*ResultRow, error)
- func (this *Result) GetFloat32() (float32, error)
- func (this *Result) GetFloat32Value(Row uint64, Column uint64) (float32, error)
- func (this *Result) GetFloat32Value_(Row uint64, Column uint64) float32
- func (this *Result) GetFloat32_() float32
- func (this *Result) GetFloat64() (float64, error)
- func (this *Result) GetFloat64Value(Row uint64, Column uint64) (float64, error)
- func (this *Result) GetFloat64Value_(Row uint64, Column uint64) float64
- func (this *Result) GetFloat64_() float64
- func (this *Result) GetInt32() (int32, error)
- func (this *Result) GetInt32Value(Row uint64, Column uint64) (int32, error)
- func (this *Result) GetInt32Value_(Row uint64, Column uint64) int32
- func (this *Result) GetInt32_() int32
- func (this *Result) GetInt64() (int64, error)
- func (this *Result) GetInt64Value(Row uint64, Column uint64) (int64, error)
- func (this *Result) GetInt64Value_(Row uint64, Column uint64) int64
- func (this *Result) GetInt64_() int64
- func (this *Result) GetJSON() (object interface{}, err error)
- func (this *Result) GetJSON_() (object interface{})
- func (this *Result) GetLastRow() (*ResultRow, error)
- func (this *Result) GetMaxColumnWidth(Column uint64) (uint64, error)
- func (this *Result) GetMaxNameWidth() uint64
- func (this *Result) GetName(Column uint64) (string, error)
- func (this *Result) GetNameLength(Column uint64) (uint64, error)
- func (this *Result) GetName_(Column uint64) string
- func (this *Result) GetNumberOfColumns() uint64
- func (this *Result) GetNumberOfRows() uint64
- func (this *Result) GetRow(Row uint64) (*ResultRow, error)
- func (this *Result) GetSQLDateTime(Row uint64, Column uint64) (time.Time, error)
- func (this *Result) GetSQLDateTime_(Row uint64, Column uint64) time.Time
- func (this *Result) GetString() (string, error)
- func (this *Result) GetStringValue(Row uint64, Column uint64) (string, error)
- func (this *Result) GetStringValue_(Row uint64, Column uint64) string
- func (this *Result) GetString_() string
- func (this *Result) GetType() byte
- func (this *Result) GetUncompressedChuckSizeSum() uint64
- func (this *Result) GetValue(Row uint64, Column uint64) (*Value, error)
- func (this *Result) GetValueType(Row uint64, Column uint64) (byte, error)
- func (this *Result) GetValueType_(Row uint64, Column uint64) byte
- func (this *Result) IsArray() bool
- func (this *Result) IsBLOB() bool
- func (this *Result) IsCommand() bool
- func (this *Result) IsError() bool
- func (this *Result) IsFloat() bool
- func (this *Result) IsInteger() bool
- func (this *Result) IsJSON() bool
- func (this *Result) IsLiteral() bool
- func (this *Result) IsNULL() bool
- func (this *Result) IsOK() bool
- func (this *Result) IsPSUB() bool
- func (this *Result) IsReconnect() bool
- func (this *Result) IsRowSet() bool
- func (this *Result) IsString() bool
- func (this *Result) IsText() bool
- func (this *Result) Rows() []ResultRow
- func (this *Result) ToJSON() string
- type ResultRow
- func (this *ResultRow) DumpToWriter(Out io.Writer, Format int, Separator string, NullValue string, NewLine string, ...) (int, error)
- func (this *ResultRow) GetFloat32(Column uint64) (float32, error)
- func (this *ResultRow) GetFloat64(Column uint64) (float64, error)
- func (this *ResultRow) GetInt32(Column uint64) (int32, error)
- func (this *ResultRow) GetInt64(Column uint64) (int64, error)
- func (this *ResultRow) GetMaxNameLength() uint64
- func (this *ResultRow) GetMaxWidth(Column uint64) (uint64, error)
- func (this *ResultRow) GetName(Column uint64) (string, error)
- func (this *ResultRow) GetNameLength(Column uint64) (uint64, error)
- func (this *ResultRow) GetNumberOfColumns() uint64
- func (this *ResultRow) GetSQLDateTime(Column uint64) (time.Time, error)
- func (this *ResultRow) GetString(Column uint64) (string, error)
- func (this *ResultRow) GetType(Column uint64) (byte, error)
- func (this *ResultRow) GetValue(Column uint64) (*Value, error)
- func (this *ResultRow) IsBLOB(Column uint64) bool
- func (this *ResultRow) IsEOF() bool
- func (this *ResultRow) IsFirst() bool
- func (this *ResultRow) IsFloat(Column uint64) bool
- func (this *ResultRow) IsInteger(Column uint64) bool
- func (this *ResultRow) IsLast() bool
- func (this *ResultRow) IsNULL(Column uint64) bool
- func (this *ResultRow) IsString(Column uint64) bool
- func (this *ResultRow) IsText(Column uint64) bool
- func (this *ResultRow) Next() *ResultRow
- func (this *ResultRow) Rewind() *ResultRow
- func (this *ResultRow) ToJSON() ([]byte, error)
- type SQCloud
- func (this *SQCloud) AddNode(Node string, Address string, Cluster string, Snapshot string, Learner bool) error
- func (this *SQCloud) Auth(Username string, Password string) error
- func (this *SQCloud) AuthWithKey(Key string) error
- func (this *SQCloud) BeginTransaction() error
- func (this *SQCloud) CheckConnectionParameter() error
- func (this *SQCloud) Close() error
- func (this *SQCloud) CloseConnection(ConnectionID string) error
- func (this *SQCloud) Compress(CompressMode string) error
- func (this *SQCloud) Connect() error
- func (this *SQCloud) CreateChannel(Channel string, NoError bool) error
- func (this *SQCloud) CreateDatabase(Database string, Key string, Encoding string, NoError bool) error
- func (this *SQCloud) DisablePlugin(Plugin string) error
- func (this *SQCloud) EnablePlugin(Plugin string) error
- func (this *SQCloud) EndTransaction() error
- func (this *SQCloud) Execute(SQL string) error
- func (this *SQCloud) ExecuteArray(SQL string, values []interface{}) error
- func (this *SQCloud) GetAutocompleteTokens() (tokens []string)
- func (this *SQCloud) GetDatabase() (string, error)
- func (this *SQCloud) GetError() (int, int, int, error)
- func (this *SQCloud) GetErrorCode() int
- func (this *SQCloud) GetErrorMessage() error
- func (this *SQCloud) GetErrorOffset() int
- func (this *SQCloud) GetExtErrorCode() int
- func (this *SQCloud) GetInfo() (SQCloudInfo, error)
- func (this *SQCloud) GetKey(Key string) (string, error)
- func (this *SQCloud) GetPAuth() (string, string)
- func (this *SQCloud) GetUUID() string
- func (this *SQCloud) IsConnected() bool
- func (this *SQCloud) IsError() bool
- func (this *SQCloud) ListChannels() ([]string, error)
- func (this *SQCloud) ListClientKeys() (map[string]string, error)
- func (this *SQCloud) ListColumns(TableName string) (columns []string)
- func (this *SQCloud) ListCommands() ([]string, error)
- func (this *SQCloud) ListConnections() ([]SQCloudConnection, error)
- func (this *SQCloud) ListDatabaseConnections(Database string) ([]SQCloudConnection, error)
- func (this *SQCloud) ListDatabaseKeys(Database string) (map[string]string, error)
- func (this *SQCloud) ListDatabases() ([]string, error)
- func (this *SQCloud) ListKeys() (map[string]string, error)
- func (this *SQCloud) ListNodes() ([]SQCloudNode, error)
- func (this *SQCloud) ListPlugins() ([]SQCloudPlugin, error)
- func (this *SQCloud) ListTables() ([]string, error)
- func (this *SQCloud) Listen(Channel string) error
- func (this *SQCloud) ListenTable(TableName string, DatabaseName string) error
- func (this *SQCloud) Notify(Channel string) error
- func (this *SQCloud) Ping() error
- func (this *SQCloud) RemoveChannel(Channel string) error
- func (this *SQCloud) RemoveDatabase(Database string, NoError bool) error
- func (this *SQCloud) RemoveKey(Key string) error
- func (this *SQCloud) RemoveNode(Node string) error
- func (this *SQCloud) RollBackTransaction() error
- func (this *SQCloud) Select(SQL string) (*Result, error)
- func (this *SQCloud) SelectArray(SQL string, values []interface{}) (*Result, error)
- func (this *SQCloud) SelectArrayKeyValues(SQL string, values []interface{}) (map[string]string, error)
- func (this *SQCloud) SelectKeyValues(SQL string) (map[string]string, error)
- func (this *SQCloud) SelectMap(SQL string) (map[string]interface{}, error)
- func (this *SQCloud) SelectSingleInt64(SQL string) (int64, error)
- func (this *SQCloud) SelectSingleString(SQL string) (string, error)
- func (this *SQCloud) SelectStringList(SQL string) ([]string, error)
- func (this *SQCloud) SelectStringListWithCol(SQL string, col uint64) ([]string, error)
- func (this *SQCloud) SendBlob(data []byte) error
- func (this *SQCloud) SendNotificationMessage(Channel string, Message string) error
- func (this *SQCloud) SetKey(Key string, Value string) error
- func (this *SQCloud) Unlisten(Channel string) error
- func (this *SQCloud) UnlistenTable(TableName string, DatabaseName string) error
- func (this *SQCloud) UnuseDatabase() error
- func (this *SQCloud) UseDatabase(Database string) error
- type SQCloudConfig
- type SQCloudConnection
- type SQCloudInfo
- type SQCloudNode
- type SQCloudNodeProgress
- type SQCloudNodeStatus
- type SQCloudPlugin
- type Value
- func (this *Value) GetBuffer() []byte
- func (this *Value) GetError() (int, int, int, string, error)
- func (this *Value) GetFloat32() (float32, error)
- func (this *Value) GetFloat64() (float64, error)
- func (this *Value) GetInt32() (int32, error)
- func (this *Value) GetInt64() (int64, error)
- func (this *Value) GetLength() uint64
- func (this *Value) GetSQLDateTime() (time.Time, error)
- func (this *Value) GetString() string
- func (this *Value) GetType() byte
- func (this *Value) IsArray() bool
- func (this *Value) IsBLOB() bool
- func (this *Value) IsCommand() bool
- func (this *Value) IsError() bool
- func (this *Value) IsFloat() bool
- func (this *Value) IsInteger() bool
- func (this *Value) IsJSON() bool
- func (this *Value) IsNULL() bool
- func (this *Value) IsOK() bool
- func (this *Value) IsPSUB() bool
- func (this *Value) IsReconnect() bool
- func (this *Value) IsRowSet() bool
- func (this *Value) IsSet() bool
- func (this *Value) IsString() bool
- func (this *Value) IsText() bool
- Bugs
Constants ¶
const ( CompressModeNo = "NO" CompressModeLZ4 = "LZ4" )
const ( CMD_STRING = '+' CMD_ZEROSTRING = '!' CMD_ERROR = '-' CMD_INT = ':' CMD_FLOAT = ',' CMD_ROWSET = '*' CMD_ROWSET_CHUNK = '/' CMD_JSON = '#' CMD_RAWJSON = '{' CMD_NULL = '_' CMD_BLOB = '$' CMD_COMPRESSED = '%' CMD_PUBSUB = '|' CMD_COMMAND = '^' CMD_RECONNECT = '@' CMD_ARRAY = '=' )
const ( NO_EXTCODE = 0 NO_OFFCODE = -1 )
const OUTFORMAT_BOX = 9
const OUTFORMAT_CSV = 1
const OUTFORMAT_HTML = 6
const OUTFORMAT_JSON = 5
const OUTFORMAT_LINE = 4
const OUTFORMAT_LIST = 0
const OUTFORMAT_MARKDOWN = 7
const OUTFORMAT_QUOTE = 2
const OUTFORMAT_TABLE = 8
const OUTFORMAT_TABS = 3
const OUTFORMAT_XML = 10
const ROWSET_TYPE_BASIC = 1
const ROWSET_TYPE_DATA_ONLY = 4
const ROWSET_TYPE_HEADER_ONLY = 3
const ROWSET_TYPE_METADATA_v1 = 2
const SQLiteCloudCA = "SQLiteCloudCA"
const SQLiteDefaultPort = 8860
Variables ¶
var OKResult = Result{ MaxHeaderWidth: 0, // contains filtered or unexported fields }
Functions ¶
func ParseTlsString ¶
func SQCloudEnquoteString ¶
SQCloudEnquoteString enquotes the given string if necessary and returns the result as a news created string. If the given string contains a '"', the '"' is properly escaped. If the given string contains one or more spaces, the whole string is enquoted with '"'
Types ¶
type Result ¶
type Result struct { // columns metadata Name []string Width []uint64 DeclType []string DbName []string TblName []string OrigName []string Notnull []int32 PriKey []int32 Autoinc []int32 MaxHeaderWidth uint64 // contains filtered or unexported fields }
The Result is either a Literal or a RowSet
func (*Result) Dump ¶
func (this *Result) Dump()
Dump outputs this query result to the screen. Warning: No line truncation is used. If you want to truncation the output to a certain width, use: Result.DumpToScreen( width )
func (*Result) DumpToScreen ¶
DumpToScreen outputs this query result to the screen. The output is truncated at a maximum line width of MaxLineLength runes (compare: Result.Dump())
func (*Result) DumpToWriter ¶
func (this *Result) DumpToWriter(Out *bufio.Writer, Format int, NoHeader bool, Separator string, NullValue string, NewLine string, MaxLineLength uint, SuppressOK bool) (int, error)
DumpToWriter renders this query result into the buffer of an io.Writer. The output Format can be specified and must be one of the following values: OUTFORMAT_LIST, OUTFORMAT_CSV, OUTFORMAT_QUOTE, OUTFORMAT_TABS, OUTFORMAT_LINE, OUTFORMAT_JSON, OUTFORMAT_HTML, OUTFORMAT_MARKDOWN, OUTFORMAT_TABLE, OUTFORMAT_BOX The Separator argument specifies the column separating string (default: '|'). All lines are truncated at MaxLineLeength. A MaxLineLangth of '0' means no truncation. If this query result is of type RESULT_OK and SuppressOK is set to false, an "OK" string is written to the buffer, otherwise nothing is written to the buffer.
func (*Result) Free ¶
func (this *Result) Free()
Free frees all memory allocated by this query result.
func (*Result) GetBufferLength ¶
GetBufferLength returns the length of the buffer of this query result.
func (*Result) GetError ¶
GetError returns the ErrorCode, ExtErrorCode, ErrorOffset, ErrorMessage and the error object of the receiver
func (*Result) GetErrorAsString ¶
func (*Result) GetFirstRow ¶
GetFirstRow returns the first row of this query result. If this query result has no row's, nil is returned instead.
func (*Result) GetFloat32 ¶
func (*Result) GetFloat32Value ¶
GetFloat32Value returns the contents in row Row and column Column of this query result as float32. The Row index is an unsigned int in the range of 0...GetNumberOfRows() - 1. The Column index is an unsigned int in the range of 0...GetNumberOfColumns() - 1.
func (*Result) GetFloat32Value_ ¶
func (*Result) GetFloat32_ ¶
func (*Result) GetFloat64 ¶
func (*Result) GetFloat64Value ¶
GetFloat64Value returns the contents in row Row and column Column of this query result as float64. The Row index is an unsigned int in the range of 0...GetNumberOfRows() - 1. The Column index is an unsigned int in the range of 0...GetNumberOfColumns() - 1.
func (*Result) GetFloat64Value_ ¶
func (*Result) GetFloat64_ ¶
func (*Result) GetInt32Value ¶
GetInt32Value returns the contents in row Row and column Column of this query result as int32. The Row index is an unsigned int in the range of 0...GetNumberOfRows() - 1. The Column index is an unsigned int in the range of 0...GetNumberOfColumns() - 1.
func (*Result) GetInt64Value ¶
GetInt64Value returns the contents in row Row and column Column of this query result as int64. The Row index is an unsigned int in the range of 0...GetNumberOfRows() - 1. The Column index is an unsigned int in the range of 0...GetNumberOfColumns() - 1.
func (*Result) GetLastRow ¶
GetLastRow returns the first row of this query result. If this query result has no row's, nil is returned instead.
func (*Result) GetMaxColumnWidth ¶
GetMaxColumnLength returns the number of runes of the value in the specified column with the maximum length in this query result. The Column index is an unsigned int in the range of 0...GetNumberOfColumns() - 1.
func (*Result) GetMaxNameWidth ¶
GetMaxNameWidth returns the number of runes of the longest column name.
func (*Result) GetName ¶
GetName returns the column name in column Column of this query result. The Column index is an unsigned int in the range of 0...GetNumberOfColumns() - 1.
func (*Result) GetNameLength ¶
GetNameWidth returns the number of runes of the column name in the specified column. The Column index is an unsigned int in the range of 0...GetNumberOfColumns() - 1.
func (*Result) GetNumberOfColumns ¶
GetNumberOfColumns returns the number of columns in this query result
func (*Result) GetNumberOfRows ¶
GetNumberOfRows returns the number of rows in this query result
func (*Result) GetRow ¶
GetRow returns a pointer to the row Row of this query result. The Row index is an unsigned int in the range of 0...GetNumberOfRows() - 1. If the index row can not be found, nil is returned instead.
func (*Result) GetSQLDateTime ¶
GetSQLDateTime parses this query result value in Row and Column as an SQL-DateTime and returns its value. The Row index is an unsigned int in the range of 0...GetNumberOfRows() - 1. The Column index is an unsigned int in the range of 0...GetNumberOfColumns() - 1.
func (*Result) GetSQLDateTime_ ¶
func (*Result) GetStringValue ¶
GetStringValue returns the contents in row Row and column Column of this query result as string. The Row index is an unsigned int in the range of 0...GetNumberOfRows() - 1. The Column index is an unsigned int in the range of 0...GetNumberOfColumns() - 1.
func (*Result) GetStringValue_ ¶
func (*Result) GetString_ ¶
func (*Result) GetType ¶
GetType returns the type of this query result as an integer (see: RESULT_ constants).
func (*Result) GetUncompressedChuckSizeSum ¶
GetUncompressedChuckSizeSum returns the
func (*Result) GetValueType ¶
GetValueType returns the type of the value in row Row and column Column of this query result. The Row index is an unsigned int in the range of 0...GetNumberOfRows() - 1. The Column index is an unsigned int in the range of 0...GetNumberOfColumns() - 1. Possible return types are: VALUE_INTEGER, VALUE_FLOAT, VALUE_TEXT, VALUE_BLOB, VALUE_NULL
func (*Result) IsCommand ¶
IsCommand returns true if this query result is of type "RESULT_XXXXXXX", false otherwise.
func (*Result) IsError ¶
IsError returns true if this query result is of type "RESULT_ERROR", false otherwise.
func (*Result) IsFloat ¶
IsFloat returns true if this query result is of type "RESULT_FLOAT", false otherwise.
func (*Result) IsInteger ¶
IsInteger returns true if this query result is of type "RESULT_INTEGER", false otherwise.
func (*Result) IsJSON ¶
IsJson returns true if this query result is of type "RESULT_JSON", false otherwise.
func (*Result) IsNULL ¶
IsNull returns true if this query result is of type "RESULT_NULL", false otherwise.
func (*Result) IsOK ¶
IsOK returns true if this query result if of type "RESULT_OK", false otherwise.
func (*Result) IsPSUB ¶
IsPSUB returns true if this query result is of type "RESULT_XXXXXXX", false otherwise.
func (*Result) IsReconnect ¶
IsReconnect returns true if this query result is of type "RESULT_XXXXXXX", false otherwise.
func (*Result) IsRowSet ¶
IsRowSet returns true if this query result is of type "RESULT_ROWSET", false otherwise.
func (*Result) IsString ¶
IsString returns true if this query result is of type "RESULT_STRING", false otherwise.
type ResultRow ¶
type ResultRow struct { Index uint64 `json:"Index"` // 0, 1, ... rows-1 Columns []Value `json:"ColumnValues"` // contains filtered or unexported fields }
func (*ResultRow) DumpToWriter ¶
func (this *ResultRow) DumpToWriter(Out io.Writer, Format int, Separator string, NullValue string, NewLine string, MaxLineLength uint) (int, error)
DumpToWriter renders this query result row into the buffer of an io.Writer. The output Format can be specified and must be one of the following values: OUTFORMAT_LIST, OUTFORMAT_CSV, OUTFORMAT_QUOTE, OUTFORMAT_TABS, OUTFORMAT_LINE, OUTFORMAT_JSON, OUTFORMAT_HTML, OUTFORMAT_MARKDOWN, OUTFORMAT_TABLE, OUTFORMAT_BOX The Separator argument specifies the column separating string (default: '|'). All lines are truncated at MaxLineLeength. A MaxLineLangth of '0' means no truncation.
func (*ResultRow) GetFloat32 ¶
GetFloat32Value returns the contents in column Column of this query result row as float32. The Column index is an unsigned int in the range of 0...GetNumberOfColumns() - 1.
func (*ResultRow) GetFloat64 ¶
GetFloat64Value returns the contents in column Column of this query result row as float64. The Column index is an unsigned int in the range of 0...GetNumberOfColumns() - 1.
func (*ResultRow) GetInt32 ¶
GetInt32Value returns the contents in column Column of this query result row as int32. The Column index is an unsigned int in the range of 0...GetNumberOfColumns() - 1.
func (*ResultRow) GetInt64 ¶
GetInt64Value returns the contents in column Column of this query result row as int64. The Column index is an unsigned int in the range of 0...GetNumberOfColumns() - 1.
func (*ResultRow) GetMaxNameLength ¶
GetMaxNameLength returns the number of runes of the longest column name.
func (*ResultRow) GetMaxWidth ¶
GetMaxWidth returns the number of runes of the value in the specified column with the maximum length in this query result. The Column index is an unsigned int in the range of 0...GetNumberOfColumns() - 1.
func (*ResultRow) GetName ¶
GetName returns the column name in column Column of this query result. The Column index is an unsigned int in the range of 0...GetNumberOfColumns() - 1.
func (*ResultRow) GetNameLength ¶
GetNameLength returns the number of runes of the column name in the specified column. The Column index is an unsigned int in the range of 0...GetNumberOfColumns() - 1.
func (*ResultRow) GetNumberOfColumns ¶
func (*ResultRow) GetSQLDateTime ¶
GetSQLDateTime parses this query result value in column Column as an SQL-DateTime and returns its value. The Column index is an unsigned int in the range of 0...GetNumberOfColumns() - 1.
func (*ResultRow) GetString ¶
GetStringValue returns the contents in column Column of this query result row as string. The Column index is an unsigned int in the range of 0...GetNumberOfColumns() - 1.
func (*ResultRow) GetType ¶
GetType returns the type of the value in column Column of this query result row. The Column index is an unsigned int in the range of 0...GetNumberOfColumns() - 1. Possible return types are: VALUE_INTEGER, VALUE_FLOAT, VALUE_TEXT, VALUE_BLOB, VALUE_NULL
func (*ResultRow) IsBLOB ¶
IsBLOB returns true if this query result row column Column is of type "VALUE_BLOB", false otherwise. The Column index is an unsigned int in the range of 0...GetNumberOfColumns() - 1.
func (*ResultRow) IsEOF ¶
IsEOF returns false if this query result row is in the result set, true otherwise.
func (*ResultRow) IsFirst ¶
IsFirst returns true if this query result row is the first in the result set, false otherwise.
func (*ResultRow) IsFloat ¶
IsFloat returns true if this query result row column Column is of type "VALUE_FLOAT", false otherwise. The Column index is an unsigned int in the range of 0...GetNumberOfColumns() - 1.
func (*ResultRow) IsInteger ¶
IsInteger returns true if this query result row column Column is of type "VALUE_INTEGER", false otherwise. The Column index is an unsigned int in the range of 0...GetNumberOfColumns() - 1.
func (*ResultRow) IsLast ¶
IsLast returns true if this query result row is the last in the result set, false otherwise.
func (*ResultRow) IsNULL ¶
IsNULL returns true if this query result row column Column is of type "VALUE_NULL", false otherwise. The Column index is an unsigned int in the range of 0...GetNumberOfColumns() - 1.
func (*ResultRow) IsString ¶
IsString returns true if this query result row column Column is of type "VALUE_TEXT", false otherwise. The Column index is an unsigned int in the range of 0...GetNumberOfColumns() - 1.
func (*ResultRow) IsText ¶
IsText returns true if this query result row column Column is of type "VALUE_TEXT" or "VALUE_BLOB", false otherwise. The Column index is an unsigned int in the range of 0...GetNumberOfColumns() - 1.
func (*ResultRow) Next ¶
Next fetches the next row in this query result and returns it, otherwise if there is no next row, nil is returned.
type SQCloud ¶
type SQCloud struct { SQCloudConfig // psubc chan string Callback func(*SQCloud, string) ErrorCode int ExtErrorCode int ErrorOffset int ErrorMessage string // contains filtered or unexported fields }
func Connect ¶
Connect creates a new connection and tries to connect to the server using the given connection string. The given connection string is parsed and checked for correct parameters. Nil and an error is returned if the connection string had invalid values or a connection to the server could not be established, otherwise, a pointer to the newly established connection is returned.
func New ¶
func New(config SQCloudConfig) *SQCloud
func (*SQCloud) AddNode ¶
func (this *SQCloud) AddNode(Node string, Address string, Cluster string, Snapshot string, Learner bool) error
AddNode - INTERNAL SERVER COMMAND: Adds a node to the SQLite Cloud Database Cluster.
func (*SQCloud) Auth ¶
Auth - INTERNAL SERVER COMMAND: Authenticates User with the given credentials.
func (*SQCloud) AuthWithKey ¶
Auth - INTERNAL SERVER COMMAND: Authenticates User with the given API KEY.
func (*SQCloud) BeginTransaction ¶
BeginTransaction starts a transaction. To finish a transaction, see: SQCloud.EndTransaction(), to undo a transaction, see: SQCloud.RollBackTransaction()
func (*SQCloud) CheckConnectionParameter ¶
CheckConnectionParameter checks the given connection arguments for validly. Host is either a resolve able hostname or an IP address. Port is an unsigned int number between 1 and 65535. Timeout must be 0 (=no timeout) or a positive number. Compress must be "NO" or "LZ4". Username, Password and Database are ignored. If a given value does not fulfill the above criteria's, an error is returned.
func (*SQCloud) Close ¶
Close closes the connection to the SQLite Cloud Database server. The connection can later be reopened (see: reconnect)
func (*SQCloud) CloseConnection ¶
CloseConnection - INTERNAL SERVER COMMAND: Closes the specified connection.
func (*SQCloud) Compress ¶
Compress enabled or disables data compression for this connection. If enabled, the data is compressed with the LZ4 compression algorithm, otherwise no compression is applied the data.
func (*SQCloud) Connect ¶
Connect connects to a SQLite Cloud server instance using the given arguments. If Connect is called on an already established connection, the old connection is closed first. All arguments are checked for valid values (see: CheckConnectionParameter). invalid argument values where given or the connection could not be established.
func (*SQCloud) CreateChannel ¶
Creates the specified Channel.
func (*SQCloud) CreateDatabase ¶
func (this *SQCloud) CreateDatabase(Database string, Key string, Encoding string, NoError bool) error
CreateDatabase - INTERNAL SERVER COMMAND: Creates a new Database on this SQLite Cloud Database Cluster. If the Database already exists on this Database Server, an error is returned except the NoError flag is set. Encoding specifies the character set Encoding that should be used for the new Database - for example "UFT-8".
func (*SQCloud) DisablePlugin ¶
DisablePlugin disables the SQLite Plugin on the SQlite Cloud Database server.
func (*SQCloud) EnablePlugin ¶
EnablePlugin enables the SQLite Plugin on the SQlite Cloud Database server.
func (*SQCloud) EndTransaction ¶
EndTransaction finishes a transaction and writes the changes to the disc. To start a transaction, see: SQCloud.BeginTransaction(), to undo a transaction, see: SQCloud.RollBackTransaction().
func (*SQCloud) Execute ¶
Execute executes the given query. If the execution was not successful, an error describing the reason of the failure is returned.
func (*SQCloud) ExecuteArray ¶
func (*SQCloud) GetAutocompleteTokens ¶
func (*SQCloud) GetDatabase ¶
GetDatabase - INTERNAL SERVER COMMAND: Gets the name of the previously selected Database as string. (see: *SQCloud.UseDatabase()) If no database was selected, an error describing the problem is returned.
func (*SQCloud) GetError ¶
GetError returned the error code and message of the last unsuccessful command. 0 and nil is returned if the last command run successful.
func (*SQCloud) GetErrorCode ¶
GetErrorCode returns the error code of the last unsuccessful command as an int value. 0 is returned if the last command run successful.
func (*SQCloud) GetErrorMessage ¶
GetErrorMessage returns the error message of the last unsuccuessful command as an error. nil is returned if the last command run successful.
func (*SQCloud) GetErrorOffset ¶
GetErrorOffset returns the error code of the last unsuccessful command as an int value. 0 is returned if the last command run successful.
func (*SQCloud) GetExtErrorCode ¶
GetExtErrorCode returns the error code of the last unsuccessful command as an int value. 0 is returned if the last command run successful.
func (*SQCloud) GetInfo ¶
func (this *SQCloud) GetInfo() (SQCloudInfo, error)
GetInfo fetches all SQLite Cloud Database server specific runtime informations and returns a SQCloudInfo structure.
func (*SQCloud) GetKey ¶
GetKey gets the Value of the key Key and returns it as a string value. If the Key was not found an error is returned.
func (*SQCloud) IsConnected ¶
IsConnected checks the connection to the SQLite Cloud database server by sending a PING command. true is returned, if the connection is established and actually working, false otherwise.
func (*SQCloud) IsError ¶
IsError checks the successful execution of the last method call / command. true is returned if the last command resulted in an error, false otherwise.
func (*SQCloud) ListChannels ¶
func (*SQCloud) ListClientKeys ¶
ListClientKeys lists all client/connection specific keys and values and returns the data in an array of type SQCloudKeyValues.
func (*SQCloud) ListColumns ¶
func (*SQCloud) ListCommands ¶
ListCommands lists all available server commands and returns them in an array of strings.
func (*SQCloud) ListConnections ¶
func (this *SQCloud) ListConnections() ([]SQCloudConnection, error)
ListConnections - INTERNAL SERVER COMMAND: Lists all connections of this SQLite Cloud Database Cluster.
func (*SQCloud) ListDatabaseConnections ¶
func (this *SQCloud) ListDatabaseConnections(Database string) ([]SQCloudConnection, error)
ListDatabaseConnections - INTERNAL SERVER COMMAND: Lists all connections that use the specified Database on this SQLite Cloud Database Cluster.
func (*SQCloud) ListDatabaseKeys ¶
ListDatabaseKeys lists all server specific keys and values and returns an array of type SQCloudKeyValues.
func (*SQCloud) ListDatabases ¶
ListDatabases - INTERNAL SERVER COMMAND: Lists all Databases that are present on this SQLite Cloud Database Cluster and returns the Names of the databases in an array of strings.
func (*SQCloud) ListKeys ¶
ListKeys lists all key value pairs on the server and returns an array of SQCloudKeyValues.
func (*SQCloud) ListNodes ¶
func (this *SQCloud) ListNodes() ([]SQCloudNode, error)
RemoveNode - INTERNAL SERVER COMMAND: Lists all nodes of this SQLite Cloud Database Cluster.
func (*SQCloud) ListPlugins ¶
func (this *SQCloud) ListPlugins() ([]SQCloudPlugin, error)
ListPlugins list all available Plugins at the SQlite Cloud Database server and returns an array of SQCloudPlugin.
func (*SQCloud) ListTables ¶
ListTables lists all tables in the selected database and returns them in an array of strings. If no database was selected with SQCloud.UseDatabase(), an error is returned.
func (*SQCloud) ListenTable ¶
Listen subscribes this connection to the specified Table.
func (*SQCloud) Ping ¶
Ping sends the PING command to the SQLite Cloud Database Server and returns nil if it got a PONG answer. If no PONG was received or a timeout occurred, an error describing the problem is retuned.
func (*SQCloud) RemoveChannel ¶
Deletes the specified Channel.
func (*SQCloud) RemoveDatabase ¶
RemoveDatabase - INTERNAL SERVER COMMAND: Deletes the specified Database on this SQLite Cloud Database Cluster. If the given Database is not present on this Database Server or the user has not the necessary access rights, an error describing the problem will be returned. If the NoError flag is set, no error will be reported if the database does not exist.
func (*SQCloud) RemoveKey ¶
RemoveKey deletes the key value pair referenced with Key. If the Key does not exists, no error is returned.
func (*SQCloud) RemoveNode ¶
RemoveNode - INTERNAL SERVER COMMAND: Removes a node to the SQLite Cloud Database Cluster.
func (*SQCloud) RollBackTransaction ¶
RollBackTransaction aborts a transaction without the writing the changes to the disc. To start a transaction, see: SQCloud.BeginTransaction(), to finish a transaction, see: SQCloud.EndTransaction().
func (*SQCloud) Select ¶
Select executes a query on an open SQLite Cloud database connection. If an error occurs during the execution of the query, nil and an error describing the problem is returned. On successful execution, a pointer to the result is returned.
func (*SQCloud) SelectArray ¶
func (*SQCloud) SelectArrayKeyValues ¶
func (*SQCloud) SelectKeyValues ¶
SelectKeyValues executes the query in SQL and returns the result as an array of SQCloudKeyValues. The given query must result in 0 or more rows and two columns. If no row was selected, an empty array is returned. If less or more than two columns where selected, an empty array and an error describing the problem is returned. In all other cases, an array of SQCloudKeyValues is returned. See: SQCloud.SelectSingleString(), SQCloud.SelectSingleInt64(), SQCloud.SelectStringList()
func (*SQCloud) SelectSingleInt64 ¶
SelectSingleInt64 executes the query in SQL and returns the result as int64. The given query must return one single numerical value. If no value, more than one values or a non-numerical value is selected by the query, 0 is returned and error describes the problem that occurred. See: SQCloud.SelectSingleString(), SQCloud.SelectStringList(), SQCloud.SelectKeyValues()
func (*SQCloud) SelectSingleString ¶
SelectSingleString executes the query in SQL and returns the result as string. The given query must return one single value. If no value or more than one values are selected by the query, nil is returned and error describes the problem that occurred. See: SQCloud.SelectSingleInt64(), SQCloud.SelectStringList(), SQCloud.SelectKeyValues()
func (*SQCloud) SelectStringList ¶
SelectStringList executes the query in SQL and returns the result as an array of strings. The given query must result in 0 or more rows and one column. If no row was selected, an empty string array is returned. If more than one column was selected, an empty string array and an error describing the problem is returned. In all other cases, an array of strings is returned. See: SQCloud.SelectSingleString(), SQCloud.SelectSingleInt64(), SQCloud.SelectKeyValues()
func (*SQCloud) SelectStringListWithCol ¶
func (*SQCloud) SendNotificationMessage ¶
SendNotificationMessage sends the message Message to the channel Channel
func (*SQCloud) SetKey ¶
SetKey set the provided key value pair with the key Key to the string value Value.
func (*SQCloud) UnlistenTable ¶
Unlisten unsubsribs this connection from the specified Table.
func (*SQCloud) UnuseDatabase ¶
UseDatabase - INTERNAL SERVER COMMAND: Releases the actual Database. Any further SQL commands will result in an error before selecting a new Database. (see: *SQCloud.UseDatabase())
func (*SQCloud) UseDatabase ¶
UseDatabase - INTERNAL SERVER COMMAND: Selects the specified Database for usage. Only if a database was selected, SQL Commands can be sent to this specific Database. An error is returned if the specified Database was not found or the user has not the necessary access rights to work with this Database.
type SQCloudConfig ¶
type SQCloudConfig struct { Host string Port int Username string Password string Database string PasswordHashed bool // Password is hashed Timeout time.Duration // Optional query timeout passed directly to TLS socket CompressMode string // eg: LZ4 Compression bool // Enable compression Zerotext bool // Tell the server to zero-terminate strings Memory bool // Database will be created in memory Create bool // Create the database if it doesn't exist? Secure bool // Connect using plain TCP port, without TLS encryption, NOT RECOMMENDED (insecure) NonLinearizable bool // Request for immediate responses from the server node without waiting for linerizability guarantees TlsInsecureSkipVerify bool // Accept invalid TLS certificates (no_verify_certificate) Pem string ApiKey string NoBlob bool // flag to tell the server to not send BLOB columns MaxData int // value to tell the server to not send columns with more than max_data bytes MaxRows int // value to control rowset chunks based on the number of rows MaxRowset int // value to control the maximum allowed size for a rowset }
func ParseConnectionString ¶
func ParseConnectionString(ConnectionString string) (config *SQCloudConfig, err error)
ParseConnectionString parses the given connection string and returns it's components. An empty string ("") or -1 is returned as the corresponding return value, if a component of the connection string was not present. No plausibility checks are done (see: CheckConnectionParameter). If the connection string could not be parsed, an error is returned.
type SQCloudConnection ¶
type SQCloudInfo ¶
type SQCloudInfo struct { SQLiteVersion string SQCloudVersion string SQCloudBuildDate time.Time SQCloudGitHash string ServerTime time.Time ServerCPUs int ServerOS string ServerArchitecture string ServicePID int ServiceStart time.Time ServicePort int ServiceNocluster int ServiceNodeID int SericeMultiplexAPI string TLS string TLSConnVersion string TLSConnCipher string TLSConnCipherStrength int TLSConnAlpnSelected string TLSConnServername string TLSPeerCertProvided int TLSPeerCertSubject string TLSPeerCertIssuer string TLSPeerCertHash string TLSPeerCertNotBefore time.Time TLSPeerCertNotAfter time.Time }
type SQCloudNode ¶
type SQCloudNode struct { NodeID int64 NodeInterface string ClusterInterface string Status SQCloudNodeStatus Progress SQCloudNodeProgress Match int64 LastActivity time.Time }
type SQCloudNodeProgress ¶
type SQCloudNodeProgress int64
const ( Probe SQCloudNodeProgress = iota Replicate Snapshot Unknown )
type SQCloudNodeStatus ¶
type SQCloudNodeStatus int64
const ( Leader SQCloudNodeStatus = iota Follower Candidate Learner )
type SQCloudPlugin ¶
type Value ¶
type Value struct { Type byte // _ + # : , $ ^ @ - /// Types that are not in this Buffer: ROWSET, PUBSUB Buffer []byte }
func (*Value) GetError ¶
GetError returns the ErrorCode, ExtErrorCode, ErrorOffset, ErrorMessage and the error object of the receiver
func (*Value) GetFloat32 ¶
func (*Value) GetFloat64 ¶
func (*Value) IsReconnect ¶
Notes ¶
Bugs ¶
If key is not set, DB returns NULL -> does not work with current implementation