https://github.com/aerospike/aerospike-client-go
Aerospike Client Go
https://github.com/aerospike/aerospike-client-go
Last synced: 7 months ago
JSON representation
Aerospike Client Go
- Host: GitHub
- URL: https://github.com/aerospike/aerospike-client-go
- Owner: aerospike
- License: apache-2.0
- Created: 2014-07-26T02:56:21.000Z (over 11 years ago)
- Default Branch: v8
- Last Pushed: 2025-05-08T19:10:20.000Z (7 months ago)
- Last Synced: 2025-05-08T20:24:34.596Z (7 months ago)
- Language: Go
- Size: 4.29 MB
- Stars: 448
- Watchers: 73
- Forks: 206
- Open Issues: 38
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Security: security_test.go
Awesome Lists containing this project
- awesome-go-plus - aerospike-client-go - Aerospike client in Go language.  (Database Drivers / NoSQL Database Drivers)
- awesome-go-storage - aerospike-client-go - Aerospike client in Go language. (Database Drivers)
- awesome-go - aerospike-client-go - Aerospike client in Go language. (Database Drivers / NoSQL Database Drivers)
- awesome-go - aerospike-client-go - Aerospike Client Go - ★ 285 (Database Drivers)
- awesome-go-storage - aerospike-client-go - Aerospike client in Go language. (Database Drivers)
- awesome-go-cn - aerospike-client-go
- fucking-awesome-go - aerospike-client-go - Aerospike client in Go language. (Database Drivers / NoSQL Database Drivers)
- awesome-go - aerospike-client-go - | - | - | (Database Drivers / Advanced Console UIs)
- awesome-go - aerospike-client-go - Aerospike client in Go language. (Database Drivers / NoSQL Database Drivers)
- awesome-go-extra - aerospike-client-go - 07-26T02:56:21Z|2022-07-27T20:56:33Z| (Generators / NoSQL Database Drivers)
- awesome-go - aerospike-client-go - Go语言的Aerospike客户端。 (<span id="数据库驱动-database-drivers">数据库驱动 Database Drivers</span> / <span id="高级控制台用户界面-advanced-console-uis">高级控制台用户界面 Advanced Console UIs</span>)
- awesome-go-cn - aerospike-client-go - client-go) [![godoc][D]](https://godoc.org/github.com/aerospike/aerospike-client-go) (数据库驱动程序 / NoSQL数据库驱动程序)
- awesome-go - aerospike-client-go - Aerospike client in Go language. (Database Drivers / NoSQL Database Drivers)
- fucking-awesome-go - :octocat: aerospike-client-go - Aerospike client in Go language. :star: 168 :fork_and_knife: 58 (Database Drivers / Advanced Console UIs)
- awesome-go - aerospike-client-go - Aerospike client in Go language. - :arrow_down:303 - :star:182 (Database Drivers / Advanced Console UIs)
- awesome-go - aerospike/aerospike-client-go
- awesome-go - aerospike-client-go - Aerospike client in Go language. (Database Drivers / Advanced Console UIs)
- awesome-go-with-stars - aerospike-client-go - Aerospike client in Go language. (Database Drivers / NoSQL Database Drivers)
- awesome-go - aerospike-client-go - Aerospike client in Go language. (Database Drivers / NoSQL Database Drivers)
- awesome-go - aerospike-client-go - Aerospike client in Go language. (Database Drivers / NoSQL Database Drivers)
- awesome-Char - aerospike-client-go - Aerospike client in Go language. (Database Drivers / Advanced Console UIs)
- awesome-go-cn - aerospike-client-go - client-go) [![godoc][D]](https://godoc.org/github.com/aerospike/aerospike-client-go) (数据库驱动程序 / NoSQL数据库驱动程序)
- awesome-go - aerospike-client-go - Aerospike client in Go language. (Database Drivers / Advanced Console UIs)
- awesome-go-cn - aerospike-client-go
README
# Aerospike Go Client v8
[](https://goreportcard.com/report/github.com/aerospike/aerospike-client-go/v8)
[](https://pkg.go.dev/github.com/aerospike/aerospike-client-go/v8)
[](github.com/aerospike/aerospike-client-go/actions)
An Aerospike library for Go.
This library is compatible with Go 1.23+ and supports the following operating systems: Linux, Mac OS X (Windows builds are possible, but untested).
Up-to-date documentation is available in the [](https://pkg.go.dev/github.com/aerospike/aerospike-client-go/v8).
You can refer to the test files for idiomatic use cases.
Please refer to [`CHANGELOG.md`](CHANGELOG.md) for release notes, or if you encounter breaking changes.
- [Aerospike Go Client v8](#aerospike-go-client-v8)
- [Usage](#usage)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Some Tips](#some-tips)
- [Performance Tweaking](#performance-tweaking)
- [Tests](#tests)
- [Examples](#examples)
- [Tools](#tools)
- [Benchmarks](#benchmarks)
- [API Documentation](#api-documentation)
- [Google App Engine](#google-app-engine)
- [Reflection, and Object API](#reflection-and-object-api)
- [License](#license)
## Usage
The following is a very simple example of CRUD operations in an Aerospike database.
```go
package main
import (
"fmt"
aero "github.com/aerospike/aerospike-client-go/v8"
)
// This is only for this example.
// Please handle errors properly.
func panicOnError(err error) {
if err != nil {
panic(err)
}
}
func main() {
// define a client to connect to
client, err := aero.NewClient("127.0.0.1", 3000)
panicOnError(err)
key, err := aero.NewKey("test", "aerospike", "key")
panicOnError(err)
// define some bins with data
bins := aero.BinMap{
"bin1": 42,
"bin2": "An elephant is a mouse with an operating system",
"bin3": []any{"Go", 2009},
}
// write the bins
err = client.Put(nil, key, bins)
panicOnError(err)
// read it back!
rec, err := client.Get(nil, key)
panicOnError(err)
// delete the key, and check if key exists
existed, err := client.Delete(nil, key)
panicOnError(err)
fmt.Printf("Record existed before delete? %v\n", existed)
}
```
More examples illustrating the use of the API are located in the
[`examples`](examples) directory.
Details about the API are available in the [`docs`](docs) directory.
[Go](http://golang.org) version v1.23+ is required.
To install the latest stable version of Go, visit
[http://golang.org/dl/](http://golang.org/dl/)
Aerospike Go client implements the wire protocol, and does not depend on the C client.
It is goroutine friendly, and works asynchronously.
Supported operating systems:
- Major Linux distributions (Ubuntu, Debian, Red Hat)
- Mac OS X
- Windows (untested)
1. Install Go 1.21+ and setup your environment as [Documented](http://golang.org/doc/code.html#GOPATH) here.
2. Get the client in your ```GOPATH``` : ```go get github.com/aerospike/aerospike-client-go/v8```
- To update the client library: ```go get -u github.com/aerospike/aerospike-client-go/v8```
### Some Tips
- To run a go program directly: ```go run ```
- to build: ```go build -o ```
- example: ```go build -tags as_performance -o benchmark tools/benchmark/benchmark.go```
We are bending all efforts to improve the client's performance. In our reference benchmarks, Go client performs almost as good as the C client.
To read about performance variables, please refer to [`docs/performance.md`](docs/performance.md)
This library is packaged with a number of tests. Tests require Ginkgo and Gomega library.
Before running the tests, you need to update the dependencies:
$ go get .
To run all the test cases with race detection:
$ ginkgo -r -race
A variety of example applications are provided in the [`examples`](examples) directory.
A variety of clones of original tools are provided in the [`tools`](tools) directory.
They show how to use more advanced features of the library to re-implement the same functionality in a more concise way.
Benchmark utility is provided in the [`tools/benchmark`](tools/benchmark) directory.
See the [`tools/benchmark/README.md`](tools/benchmark/README.md) for details.
A simple API documentation is available in the [`docs`](docs/README.md) directory. The latest up-to-date docs can be found in [](https://pkg.go.dev/github.com/aerospike/aerospike-client-go/v8).
To build the library for App Engine, build it with the build tag `app_engine`. Aggregation functionality is not available in this build.
To make the library both flexible and fast, we had to integrate the reflection API (methods with `[Get/Put/...]Object` names) tightly in the library. In case you wanted to avoid mixing those API in your app inadvertently, you can use the build tag `as_performance` to remove those APIs from the build.
The Aerospike Go Client 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.