Documentation ¶
Index ¶
- Constants
- func QuoteStr(str string) string
- func Transpose(matrix [][]interface{}) [][]interface{}
- type Attributes
- type AuthData
- type Conn
- func (c *Conn) BulkExecute(sql string, data *bytes.Buffer) error
- func (c *Conn) BulkInsert(schema, table string, data *bytes.Buffer) (err error)
- func (c *Conn) BulkQuery(sql string, data *bytes.Buffer) error
- func (c *Conn) BulkSelect(schema, table string, data *bytes.Buffer) (err error)
- func (c *Conn) Commit() error
- func (c *Conn) DisableAutoCommit() error
- func (c *Conn) Disconnect()
- func (c *Conn) EnableAutoCommit() error
- func (c *Conn) Execute(sql string, args ...interface{}) (rowsAffected int64, err error)
- func (c *Conn) FetchChan(sql string, args ...interface{}) (<-chan []interface{}, error)
- func (c *Conn) FetchSlice(sql string, args ...interface{}) (res [][]interface{}, err error)
- func (c *Conn) GetSessionAttr() (*Attributes, error)
- func (c *Conn) Lock()
- func (c *Conn) QuoteIdent(ident string, args ...interface{}) string
- func (c *Conn) Rollback() error
- func (c *Conn) SetTimeout(timeout uint32) error
- func (c *Conn) StreamExecute(origSQL string, data <-chan []byte) error
- func (c *Conn) StreamInsert(schema, table string, data <-chan []byte) (err error)
- func (c *Conn) StreamQuery(exportSQL string) *Rows
- func (c *Conn) StreamSelect(schema, table string) *Rows
- func (c *Conn) Unlock()
- type ConnConf
- type DataType
- type Logger
- type Proxy
- type Rows
- type WSHandler
Constants ¶
const DriverVersion = "2"
const ExasolAPIVersion = 3
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Attributes ¶
type Attributes struct { Autocommit bool `json:"autocommit,omitempty"` CompressionEnabled bool `json:"compressionEnabled,omitempty"` CurrentSchema string `json:"currentSchema,omitempty"` DateFormat string `json:"dateFormat,omitempty"` DateLanguage string `json:"dateLanguage,omitempty"` DatetimeFormat string `json:"datetimeFormat,omitempty"` DefaultLikeEscapeCharacter string `json:"defaultLikeEscapeCharacter,omitempty"` FeedbackInterval uint32 `json:"feedbackInterval,omitempty"` NumericCharacters string `json:"numericCharacters,omitempty"` OpenTransaction int `json:"openTransaction,omitempty"` // Boolean, really (1/0) QueryTimeout uint32 `json:"queryTimeout,omitempty"` SnapshotTransactionsEnabled bool `json:"snapshotTransactionsEnabled,omitempty"` TimestampUtcEnabled bool `json:"timestampUtcEnabled,omitempty"` Timezone string `json:"timezone,omitempty"` TimeZoneBehavior string `json:"timeZoneBehavior,omitempty"` }
This struct needs to be visible outside this package because it is returned by GetSessionAttr
type AuthData ¶
type AuthData struct { SessionID uint64 `json:"sessionId"` ProtocolVersion float64 `json:"protocolVersion"` ReleaseVersion string `json:"releaseVersion"` DatabaseName string `json:"databaseName"` ProductName string `json:"productName"` MaxDataMessageSize uint64 `json:"maxDataMessageSize"` MaxIdentifierLength uint64 `json:"maxIdentifierLength"` MaxVarcharLength uint64 `json:"maxVarcharLength"` IdentifierQuoteString string `json:"identifierQuoteString"` TimeZone string `json:"timeZone"` TimeZoneBehavior string `json:"timeZoneBehavior"` }
type Conn ¶
type Conn struct { Conf ConnConf SessionID uint64 Stats map[string]int Metadata *AuthData // contains filtered or unexported fields }
func (*Conn) BulkInsert ¶
func (*Conn) BulkSelect ¶
func (*Conn) DisableAutoCommit ¶
func (*Conn) Disconnect ¶
func (c *Conn) Disconnect()
func (*Conn) EnableAutoCommit ¶
func (*Conn) Execute ¶
TODO change optional args into an ExecConf struct Optional args are binds, default schema, colDefs, isColumnar flag
- The binds are data bindings for statements containing placeholders. You can either specify it as []interface{} if there's only one row or as [][]interface{} if there are multiple rows.
- Specifying the default schema allows you to use non-schema-qualified table identifiers in the statement even when you have no schema currently open.
- The colDefs option expects a []DataTypes. This is only necessary if you are working around a bug that existed in pre-v6.0.9 of Exasol (https://www.exasol.com/support/browse/EXASOL-2138)
- The isColumnar boolean indicates whether the binds specified in the first optional arg are in columnar format (By default the are in row format.)
func (*Conn) FetchChan ¶
Optional args are binds, and default schema
- The binds are data bindings for queries containing placeholders. You can specify it []interface{}
- Specifying the default schema allows you to use non-schema-qualified table identifiers in the statement even when you have no schema currently open.
func (*Conn) FetchSlice ¶
For large datasets use FetchChan to avoid buffering all the data in memory
func (*Conn) GetSessionAttr ¶
func (c *Conn) GetSessionAttr() (*Attributes, error)
func (*Conn) Lock ¶
func (c *Conn) Lock()
Gets a sync.Mutext lock on the handle. Allows coordinating use of the handle across multiple Go routines
func (*Conn) QuoteIdent ¶
func (*Conn) SetTimeout ¶
func (*Conn) StreamInsert ¶
func (*Conn) StreamQuery ¶
func (*Conn) StreamSelect ¶
type ConnConf ¶
type ConnConf struct { Host string Port uint16 Username string Password string ClientName string ClientVersion string ConnectTimeout time.Duration QueryTimeout time.Duration TLSConfig *tls.Config SuppressError bool // Server errors are logged to Error by default // TODO try compressionEnabled: true Logger Logger // Optional for better control over logging WSHandler WSHandler // Optional for intercepting websocket traffic CachePrepStmts bool Timeout uint32 // Deprecated - Use Query/ConnectTimeout instead }
type DataType ¶
type DataType struct { Type string `json:"type"` Precision int `json:"precision"` Scale int `json:"scale"` Size int `json:"size"` CharacterSet string `json:"characterSet,omitempty"` WithLocalTimeZone bool `json:"withLocalTimeZone,omitempty"` Fraction int `json:"fraction,omitempty"` SRId int `json:"srid,omitempty"` }
This is visible outside of this package because it is passed in as a connection parameter
type Rows ¶
type WSHandler ¶
type WSHandler interface { // tls.Config is optional. If specified SSL should be enabled // time.Duration is the connect timeout (or zero for none) Connect(url.URL, *tls.Config, time.Duration) error EnableCompression(bool) // Write/ReadJSON will be passed structs from api.go WriteJSON(interface{}) error ReadJSON(interface{}) error Close() }
By default we use the gorilla/websocket implementation however you can also specify a custom websocket handler which you can then use to intercept API traffic. This is handy for:
- Using a non-gorilla websocket library
- Emulating Exasol for testing purposes
- Intercepting and manipulating the traffic (e.g. for buffering, caching etc)
See websocket_handler.go for the default implementation. The custom websocket handler must conform to the following interface: