nuodb

package module
Version: v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2020 License: MIT Imports: 11 Imported by: 0

README

go-nuodb

NuoDB driver for Go(golang) database/sql interface.

It wraps the libNuoRemote.so C++ API with a custom C API and then uses Cgo for calling it.

Setup

Installation requires NuoDB in /opt/nuodb and properly set $GOPATH.

$ go get -d github.com/tilinna/go-nuodb
$ make -C `go env GOPATH`/src/github.com/tilinna/go-nuodb install

Usage

package main

import (
  "database/sql"
	_ "github.com/tilinna/go-nuodb"
)

func main() {
	// func Open(driverName, dataSourceName string) (*DB, error)
	db, err := sql.Open("nuodb", "nuodb://robinh:crossbow@localhost:48004/tests?schema=abcd&timezone=UTC")
}

dataSourceName url string

Mandatory:

nuodb:// username : password @ broker_address / database

Optional:

  • schema=default schema
  • timezone=default timezone

Test

1. Configure NuoDB
$ java -jar /opt/nuodb/jar/nuoagent.jar --broker --domain go-nuodb --password archer &
$ /opt/nuodb/bin/nuodb --allow-non-durable --database tests --initialize --password archer --dba-user robinh --dba-password crossbow &
2. Run the tests
$ make -C `go env GOPATH`/src/github.com/tilinna/go-nuodb test

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

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

func (*Conn) Begin

func (c *Conn) Begin() (driver.Tx, error)

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) Exec

func (c *Conn) Exec(sql string, args []driver.Value) (driver.Result, error)

func (*Conn) Prepare

func (c *Conn) Prepare(sql string) (driver.Stmt, error)

type Error

type Error struct {
	Code    ErrorCode
	Message string
}

Error is an error type which represents a single instance of a NuoDB error

func (*Error) Error

func (e *Error) Error() string

type ErrorCode

type ErrorCode int

ErrorCode represents an error defined by NuoDB Definitions can be found here: http://doc.nuodb.com/Latest/Default.htm#SQL-Error-Codes.htm

func (*ErrorCode) Name

func (c *ErrorCode) Name() string

Name returns a short name for the error code

type Result

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

func (*Result) LastInsertId

func (result *Result) LastInsertId() (int64, error)

func (*Result) RowsAffected

func (result *Result) RowsAffected() (int64, error)

type Rows

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

func (*Rows) Close

func (rows *Rows) Close() error

func (*Rows) Columns

func (rows *Rows) Columns() []string

func (*Rows) Next

func (rows *Rows) Next(dest []driver.Value) error

type Stmt

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

func (*Stmt) Close

func (stmt *Stmt) Close() error

func (*Stmt) Exec

func (stmt *Stmt) Exec(args []driver.Value) (driver.Result, error)

func (*Stmt) NumInput

func (stmt *Stmt) NumInput() int

func (*Stmt) Query

func (stmt *Stmt) Query(args []driver.Value) (driver.Rows, error)

type Tx

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

func (*Tx) Commit

func (tx *Tx) Commit() error

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Source Files

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