Skip to content

kineticadb/kinetica-api-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kinetica Logo

Kinetica GOLANG API

Overview

This project contains the source code of the Golang Kinetica API.

The documentation can be found at https://docs.kinetica.com/7.2/.

Usage

For using this API in a GO project add the lines

require (
	github.com/kineticadb/gpudb-api-go v0.0.4
)

to the go.mod file of your project.

For changes to the client-side API, please refer to CHANGELOG.md.

Starter example

package main

import (
	"context"
	"fmt"
	"os"
	"sync"
	"time"
	
	"github.com/kineticadb/gpudb-api-go/example"
	"github.com/kineticadb/gpudb-api-go/kinetica"
	"go.uber.org/multierr"
	"go.uber.org/zap"
)

func main() {
	endpoint := os.Args[1]
	username := os.Args[2]
	password := os.Args[3]
	
	ctx := context.TODO()
	options := kinetica.KineticaOptions{Username: username, Password: password}
	dbInst := kinetica.NewWithOptions(ctx, endpoint, &options)
}

Logging

The logging is done using Uber zap package and lumberjack for rotating files based on size. Time based rotation is not supported yet. The configuration for lumberjack can be found here - https://pkg.go.dev/gopkg.in/natefinch/lumberjack.v2

Default Log Config file

This is included and will be used in case a user defined config file is not found. The name of the file is log_config.yaml.

level: 'info'
development: true
disableCaller: false
disableStacktrace: false
encoding: 'console'
encoderConfig:
  messageKey: 'msg'
  levelKey: 'level'
  timeKey: 'ts'
  nameKey: 'logger'
  callerKey: 'caller'
  functionKey: 'function'
  stacktraceKey: 'stacktrace'
  skipLineEnding: false
  lineEnding: "\n"
  levelEncoder: 'capital'
  timeEncoder: 'iso8601'
  durationEncoder: 'string'
  callerEncoder: 'full'
  nameEncoder: 'full'
  consoleSeparator: ' | '
outputPaths:
  # Implements logging to the console
  - 'stdout'
  # Implements rolling logs using lumberjack logger; config parameters are supplied as
  # query params. Here maxSize is 10MB after which the logger rolls over; maximum
  # number of backups (maxBackups) kept is 5 and maxAge is 10 days.
  # The name of the log file in this case is "logs/gpudb-api.log" where the
  # "logs" directory is under the current directory on the local machine.
  - 'lumberjack://localhost/logs/gpudb-api.log?maxSize=10&maxBackups=5&maxAge=10'
errorOutputPaths:
  - 'stderr'
  - './logs/error_logs'
initialFields:
  app: 'gpudb-api'

Support

For bugs, please submit an issue on Github.

For support, you can post on stackoverflow under the kinetica tag or Slack.

Contact Us