• Stars
    star
    9
  • Rank 1,939,727 (Top 39 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created over 8 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Datastore Connectivity for Aerospike for go

Datastore Connectivity for Aerospike (asc)

Datastore Connectivity library for Aerospike in Go. GoDoc

This library is compatible with Go 1.11+

Please refer to CHANGELOG.md if you encounter breaking changes.

Configuration parameters

aerospike client/policy config params
  • timeoutMs
  • connectionTimeout
  • serverSocketTimeout
  • scanPct
  • host
  • port
  • namespace
  • sleepBetweenRetries
  • batchSize
keyColumn, keyColumnName

Defines name of column used as record key ('id' by default)

It can be specified per table i.e

events.keyColumn = code
excludedColumns

List of columns to be excluded from record (i.e: id - in case we need it only as record key)

dateFormat

ISO date format used to time.Time conversion

optimizeLargeScan

Experimental feature that first scan all keys and write then to disk and then separate go routines scan data using the dumped keys

You can only specify scanBaseDirectory

Usage:

The following is a very simple example of CRUD operations with dsc

config.yaml

driverName: aerospike
parameters:
  namespace: test
  host: 127.0.0.1
  dateFormat: yyyy-MM-dd hh:mm:ss
package main

import (
    _ "github.com/aerospike/aerospike-client-go"
    _ "github.com/viant/asc"
    "github.com/viant/dsc"
    "log"
)


type Interest struct {
	Id int	`autoincrement:"true"`
	Name string
	ExpiryTimeInSecond int `column:"expiry"`
	Category string
}


func main() {


	config, err := dsc.NewConfigFromURL("config.yaml")
	if err != nil {
		log.Fatal(err)
	}
	factory := dsc.NewManagerFactory()
	manager, err := factory.Create(config)
	if err != nil {
		log.Fatal(err)
	}



  	// manager := factory.CreateFromURL("file:///etc/myapp/datastore.json")
  
    interest := &Interest{}
    
    success, err:= manager.ReadSingle(interest, "SELECT id, name, expiry, category FROM interests WHERE id = ?", []interface{}{id},nil)
	if err != nil {
        panic(err.Error())
	}

    var intersts = make([]*Interest, 0)
    err = manager.ReadAll(&intersts, "SELECT id, name, expiry, category FROM interests", nil ,nil)
    if err != nil {
        panic(err.Error())
    }

    
    intersts = []*Interest {
        Interest{Name:"Abc", ExpiryTimeInSecond:3600, Category:"xyz"},
        Interest{Name:"Def", ExpiryTimeInSecond:3600, Category:"xyz"},
        Interest{Id:"20, Name:"Ghi", ExpiryTimeInSecond:3600, Category:"xyz"},
    }


	_, _, err = manager.PersistAll(&intersts, "intersts", nil)
	if err != nil {
        panic(err.Error())
   	}
   	fmt.Printf("Inserted %v, updated: %v\n", inserted, updated)
  
    deleted, err := manager.DeleteAll(&intersts, "intersts", nil)
    if err != nil {
        panic(err.Error())
   	}
 	fmt.Printf("Inserted %v, updated: %v\n", deleted)


 	
 	var records = []map[string]interface{}{}
 	 err = manager.ReadAll(&records, "SELECT id, name, expiry, category FROM interests", nil ,nil)
    if err != nil {
        panic(err.Error())
    }
}

Query level UDF support

  • ARRAY converts supplied source column into collection of map entry defined as (key, value)
SELECT 
  id, 
  username, 
ARRAY(city_visited) AS visited
FROM users
  • JSON convert supplied source column to JSON
SELECT 
  id, 
  username, 
JSON(city_visited) AS visited
FROM users

GoCover

GoCover

License

The source code is made available under the terms of the Apache License, Version 2, as stated in the file LICENSE.

Individual files may be made available under their own specific license, all compatible with Apache License, Version 2. Please see individual files for details.

Credits and Acknowledgements

Library Author: Adrian Witas

Contributors:

More Repositories

1

afs

Abstract File Storage
Go
301
star
2

endly

End to end functional test and automation framework
Go
262
star
3

toolbox

Toolbox - go utility library
Go
196
star
4

bqtail

BigQuery Google Storage Based Data Loader
Go
49
star
5

dsunit

Datastore Testibility
Go
43
star
6

ptrie

A prefix tree implementation in go
Go
39
star
7

xunsafe

Faster golang reflection
Go
29
star
8

dsc

Datastore Connectivity in go
Go
27
star
9

dbsync

RDBMS synchronizer
Go
22
star
10

bgc

Datastore Connectivity for BigQuery in go
Go
20
star
11

gohessian

Hessian serializer written for Go
Go
15
star
12

vec

Vectorization toolkit for golang
Assembly
12
star
13

afsc

Abstract File Storage Connectors
Go
11
star
14

assertly

Arbitraty datastructure validation
Go
10
star
15

bintly

super fast binary serialization for go
Go
9
star
16

smirror

Serverless cloud storage mirror
Go
9
star
17

datly

Go
8
star
18

bigquery

BigQuery database/sql golang driver
Go
8
star
19

CacheStore

A key-value hybrid storage system with a powerful API that utilizes both memory cache and disk to optimize performance.
Java
7
star
20

neatly

Neatly - a neat format for representing nested structured data.
Go
5
star
21

gmetric

Operation metric for go
Go
5
star
22

scache

Cache in go
Go
5
star
23

parsly

Parsing utility (lexer/tokenizer)
Go
5
star
24

etly

ETL framework
Go
4
star
25

mmcb

Memory mapped compactable buffer in go
Go
4
star
26

jdsunit

Java Client for Dsunit server
Java
4
star
27

velty

Template language for go
Go
4
star
28

bqwt

BigQuery Windowed Tables
Go
4
star
29

bitsy

Bitset data indexer
Go
4
star
30

igo

Go evaluator in go
Go
3
star
31

cloudless

Serverless toolbox
Go
3
star
32

mly

Machine Learning executor on steroid for golang
Go
2
star
33

voldemort-storage

HTML
2
star
34

gtly

Generic data stracture for go
Go
2
star
35

tapper

High performant transaction logger
Go
2
star
36

hessian-sm

HTML
2
star
37

rta

Real Time Aggregation for golang
Go
2
star
38

structql

Go struct query
Go
1
star
39

drone-gcloud

Drone plugin to execute gcloud and gsutil commands
Shell
1
star
40

drone-json

Drone plugin to validate JSON files
Python
1
star
41

CacheStore-deploy-cluster

A ready to use deployment of CacheStore Cluster. Includes CacheStore, cluster start up scripts, and cluster configurations.
Shell
1
star
42

scy

Scy - secure store api for golang
Go
1
star
43

sqlx

Go lang sql extensions
Go
1
star
44

CacheStore-deploy

A ready to use deployment of CacheStore remote (default). Includes CacheStore, start up scripts for remote, and remote configurations.
Shell
1
star