Documentation
¶
Index ¶
- type CrateDriver
- func (c *CrateDriver) Begin() (driver.Tx, error)
- func (c *CrateDriver) Close() error
- func (c *CrateDriver) Exec(stmt string, args []driver.Value) (result driver.Result, err error)
- func (c *CrateDriver) Open(crate_url string) (driver.Conn, error)
- func (c *CrateDriver) Prepare(query string) (driver.Stmt, error)
- func (c *CrateDriver) Query(stmt string, args []driver.Value) (driver.Rows, error)
- type CrateErr
- type CrateStmt
- type Result
- type Rows
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CrateDriver ¶
type CrateDriver struct {
Url string // Crate http endpoint url
}
Crate conn structure
func (*CrateDriver) Close ¶
func (c *CrateDriver) Close() error
Nothing to close, crate is stateless
func (*CrateDriver) Open ¶
func (c *CrateDriver) Open(crate_url string) (driver.Conn, error)
Init a new "Connection" to a Crate Data Storage instance. Note that the connection is not tested until the first query.
func (*CrateDriver) Prepare ¶
func (c *CrateDriver) Prepare(query string) (driver.Stmt, error)
Driver method that initiates the prepared stmt interface
func (*CrateDriver) Query ¶
Queries the database
Example ¶
package main
import (
"database/sql"
"fmt"
"log"
_ "github.com/herenow/go-crate"
)
func main() {
db, err := sql.Open("crate", "http://localhost:4200")
if err != nil {
log.Fatal(err)
}
rows, err := db.Query("SELECT name FROM sys.cluster")
if err != nil {
log.Fatal(err)
}
defer rows.Close()
for rows.Next() {
var name string
if err := rows.Scan(&name); err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", name)
}
if err := rows.Err(); err != nil {
log.Fatal(err)
}
}
type CrateErr ¶
Specific Crate errors returned by the endpoint. Use this to type check for database errors.
type CrateStmt ¶
type CrateStmt struct {
// contains filtered or unexported fields
}
Prepared stmt interface
Click to show internal directories.
Click to hide internal directories.