monetdb

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: MPL-2.0 Imports: 18 Imported by: 1

Documentation

Overview

Package monetdb contains a database driver for MonetDB.

Use the following format for the Data Source Name (DSN) to make connection to the MonetDB server.

[username[:password]@]hostname[:port]/database

If the port is not specified, then the default port 50000 will be used.

Please check the project's GitHub page for more complete documentation - https://github.com/fajran/go-monetdb

Index

Constants

View Source
const MAPI_STATE_INIT = 0

MAPI connection is NOT established.

View Source
const MAPI_STATE_READY = 1

MAPI connection is established.

Variables

This section is empty.

Functions

func Cut added in v1.0.2

func Cut(s, sep string) (before, after string, found bool)

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) Prepare

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

type Date

type Date struct {
	Year  int
	Month time.Month
	Day   int
}

Time represents MonetDB's Date datatype.

func GetDate

func GetDate(t time.Time) Date

GetDate takes the date part of a time.Time and put it in a Date

func (Date) String

func (d Date) String() string

String returns a string representation of a Date in the form "YYYY-MM-DD"

func (Date) Time

func (d Date) Time() time.Time

Time converts to time.Time. The time is set to 00:00:00.

type Driver

type Driver struct {
}

func (*Driver) Open

func (*Driver) Open(name string) (driver.Conn, error)

type MapiConn

type MapiConn struct {
	Hostname string
	Port     int
	Username string
	Password string
	Database string
	Language string

	State int
	// contains filtered or unexported fields
}

MapiConn is a MonetDB's MAPI connection handle.

The values in the handle are initially set according to the values that are provided when calling NewMapi. However, they may change depending on how the MonetDB server redirects the connection. The final values are available after the connection is made by calling the Connect() function.

The State value can be either MAPI_STATE_INIT or MAPI_STATE_READY.

func NewMapi

func NewMapi(hostname string, port int, username, password, database, language string) *MapiConn

NewMapi returns a MonetDB's MAPI connection handle.

To establish the connection, call the Connect() function.

func (*MapiConn) Cmd

func (c *MapiConn) Cmd(operation string) (string, error)

Cmd sends a MAPI command to MonetDB.

func (*MapiConn) Connect

func (c *MapiConn) Connect() error

Connect starts a MAPI connection to MonetDB server.

func (*MapiConn) Disconnect

func (c *MapiConn) Disconnect()

Disconnect closes the connection.

type Result

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

func (Result) LastInsertId

func (r Result) LastInsertId() (int64, error)

func (Result) RowsAffected

func (r Result) RowsAffected() (int64, error)

type Rows

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

func (*Rows) Close

func (r *Rows) Close() error

func (*Rows) Columns

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

func (*Rows) Next

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

type Stmt

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

func (*Stmt) Close

func (s *Stmt) Close() error

func (*Stmt) Exec

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

func (*Stmt) NumInput

func (s *Stmt) NumInput() int

func (*Stmt) Query

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

type Time

type Time struct {
	Hour, Min, Sec int
}

Time represents MonetDB's Time datatype.

func GetTime

func GetTime(t time.Time) Time

GetTime takes the clock part of a time.Time and put it in a Time

func (Time) String

func (t Time) String() string

String returns a string representation of a Time in the form "HH:YY:MM".

func (Time) Time

func (t Time) Time() time.Time

Time converts to time.Time. The date is set to January 1, 1970.

type Tx

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

func (*Tx) Commit

func (t *Tx) Commit() error

func (*Tx) Rollback

func (t *Tx) Rollback() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL