ProductPromotion
Logo

Go.Lang

made by https://0x3d.site

GitHub - viant/asc: Datastore Connectivity for Aerospike for go
Datastore Connectivity for Aerospike for go. Contribute to viant/asc development by creating an account on GitHub.
Visit Site

GitHub - viant/asc: Datastore Connectivity for Aerospike for go

GitHub - viant/asc: 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:

Articles
to learn more about the golang concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

Queries
or most google FAQ's about GoLang.

mail [email protected] to add more queries here ๐Ÿ”.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory