Giter Site home page Giter Site logo

go-nuodb's Introduction

go-nuodb

NuoDB driver for Go database/sql interface.

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

Tested with Go 1.1beta2 and NuoDB 1.0.2-142-902dc7c on x86_64 CentOS 6.4.

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
$ go install github.com/tilinna/go-nuodb

Install the libcnuodb.so to some of the common LIB paths (this is not needed to run the package tests):

$ sudo install `go env GOPATH`/src/github.com/tilinna/go-nuodb/libcnuodb.so /usr/lib64/libcnuodb.so

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

$ go test -ldflags="-r ." github.com/tilinna/go-nuodb

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.