• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.travis/H09-Nov-2020-

docs/H09-Nov-2020-

examples/H09-Nov-2020-

internal/H09-Nov-2020-

logger/H09-Nov-2020-

performance/H09-Nov-2020-

pkg/H09-Nov-2020-

test/resources/H09-Nov-2020-

tools/H09-Nov-2020-

types/H09-Nov-2020-

utils/H09-Nov-2020-

.build.ymlH A D09-Nov-2020544

.gitignoreH A D09-Nov-2020113

.travis.ymlH A D09-Nov-20202.9 KiB

CHANGELOG.mdH A D09-Nov-202050.4 KiB

LICENSEH A D09-Nov-202011.1 KiB

README.mdH A D09-Nov-20206.3 KiB

admin_command.goH A D09-Nov-202017.7 KiB

admin_policy.goH A D09-Nov-20201.2 KiB

aerospike.goH A D09-Nov-2020702

aerospike_bench_reflect_test.goH A D09-Nov-20201.9 KiB

aerospike_bench_test.goH A D09-Nov-20202.7 KiB

aerospike_suite_test.goH A D09-Nov-20203.9 KiB

anonymous_fields_test.goH A D09-Nov-20203.2 KiB

auth_mode.goH A D09-Nov-20201.1 KiB

batch_command.goH A D09-Nov-20202.9 KiB

batch_command_exists.goH A D09-Nov-20203.6 KiB

batch_command_get.goH A D09-Nov-20206.3 KiB

batch_command_get_reflect.goH A D09-Nov-20202.4 KiB

batch_command_reflect.goH A D09-Nov-20202.6 KiB

batch_index_command_get.goH A D09-Nov-20201.6 KiB

batch_node.goH A D09-Nov-20205.4 KiB

batch_policy.goH A D09-Nov-20203.7 KiB

batch_read.goH A D09-Nov-20201.9 KiB

bench_batchget_test.goH A D09-Nov-20204.1 KiB

bench_cdt_list_test.goH A D09-Nov-20202.6 KiB

bench_packing_test.goH A D09-Nov-20205.9 KiB

bench_rand_gen_test.goH A D09-Nov-20201.4 KiB

bench_read_command_test.goH A D09-Nov-20203.9 KiB

bench_values_test.goH A D09-Nov-20203.1 KiB

bench_write_command_test.goH A D09-Nov-20203.9 KiB

bin.goH A D09-Nov-20201.2 KiB

bit_overflow_action.goH A D09-Nov-20201.2 KiB

bit_policy.goH A D09-Nov-2020852

bit_resize_flags.goH A D09-Nov-20201.1 KiB

bit_write_flags.goH A D09-Nov-20201.4 KiB

buffered_connection.goH A D09-Nov-20203.5 KiB

bytes_buffer.goH A D09-Nov-20201.1 KiB

cdt.goH A D09-Nov-20204.7 KiB

cdt_bitwise.goH A D09-Nov-202017.3 KiB

cdt_bitwise_test.goH A D09-Nov-202029.1 KiB

cdt_context.goH A D09-Nov-20202.9 KiB

cdt_list.goH A D09-Nov-202037.4 KiB

cdt_list_test.goH A D09-Nov-202032.5 KiB

cdt_map.goH A D09-Nov-202031.1 KiB

cdt_map_test.goH A D09-Nov-202030.3 KiB

client.goH A D09-Nov-202047.3 KiB

client_appengine_exclusions.goH A D09-Nov-20204.3 KiB

client_object_test.goH A D09-Nov-202036.2 KiB

client_policy.goH A D09-Nov-20207.8 KiB

client_reflect.goH A D09-Nov-202010.2 KiB

client_reflect_test.goH A D09-Nov-202012.4 KiB

client_test.goH A D09-Nov-202048.8 KiB

cluster.goH A D09-Nov-202026.4 KiB

command.goH A D09-Nov-202050.5 KiB

commit_policy.goH A D09-Nov-20201.1 KiB

compat_after_go1.8.goH A D09-Nov-2020725

compat_before_go1.8.goH A D09-Nov-20201.5 KiB

complex_index_test.goH A D09-Nov-20203.1 KiB

complex_query_test.goH A D09-Nov-20206.1 KiB

connection.goH A D09-Nov-202011.2 KiB

connection_heap.goH A D09-Nov-20206 KiB

connection_heap_test.goH A D09-Nov-20202.5 KiB

delete_command.goH A D09-Nov-20202.6 KiB

example_client_test.goH A D09-Nov-20202.2 KiB

example_listiter_int_test.goH A D09-Nov-20201.5 KiB

example_listiter_string_test.goH A D09-Nov-20201.6 KiB

example_listiter_time_test.goH A D09-Nov-20201.7 KiB

example_mapiter_test.goH A D09-Nov-20201.8 KiB

execute_command.goH A D09-Nov-20201.8 KiB

execute_task.goH A D09-Nov-20202.8 KiB

exists_command.goH A D09-Nov-20202.5 KiB

field_type.goH A D09-Nov-20201.6 KiB

filter.goH A D09-Nov-20206.3 KiB

generation_policy.goH A D09-Nov-20201.1 KiB

generics.goH A D09-Nov-202064.4 KiB

geo_test.goH A D09-Nov-20206.3 KiB

helper_test.goH A D09-Nov-20201.1 KiB

hll_operation.goH A D09-Nov-20208.8 KiB

hll_operation_test.goH A D09-Nov-202026.3 KiB

hll_policy.goH A D09-Nov-20201,013

hll_write_flags.goH A D09-Nov-20201.5 KiB

host.goH A D09-Nov-20201.2 KiB

index_collection_type.goH A D09-Nov-20201.2 KiB

index_test.goH A D09-Nov-20203.4 KiB

index_type.goH A D09-Nov-2020937

info.goH A D09-Nov-20203.1 KiB

info_policy.goH A D09-Nov-20201.2 KiB

key.goH A D09-Nov-20204.7 KiB

key_bench_test.goH A D09-Nov-20203.8 KiB

key_helper.goH A D09-Nov-20203.5 KiB

key_reflect_test.goH A D09-Nov-20201.4 KiB

key_test.goH A D09-Nov-20205.7 KiB

language.goH A D09-Nov-2020762

load_test.goH A D09-Nov-20202.3 KiB

login_command.goH A D09-Nov-20206.2 KiB

marshal.goH A D09-Nov-20209.2 KiB

multi_command.goH A D09-Nov-20209.5 KiB

multi_policy.goH A D09-Nov-20202.2 KiB

node.goH A D09-Nov-202025.9 KiB

node_error.goH A D09-Nov-20202 KiB

node_stats.goH A D09-Nov-20204.1 KiB

node_test.goH A D09-Nov-20208.6 KiB

node_validator.goH A D09-Nov-20208.8 KiB

operate_command.goH A D09-Nov-20202.3 KiB

operation.goH A D09-Nov-20204.2 KiB

packer.goH A D09-Nov-202015 KiB

packer_reflect.goH A D09-Nov-20202.6 KiB

packing_test.goH A D09-Nov-202012.1 KiB

partition.goH A D09-Nov-20207.2 KiB

partition_parser.goH A D09-Nov-20207.2 KiB

partitions.goH A D09-Nov-20205.4 KiB

peers.goH A D09-Nov-20202.2 KiB

peers_parser.goH A D09-Nov-20205 KiB

policy.goH A D09-Nov-20207.3 KiB

predexp.goH A D09-Nov-202016.9 KiB

predexp_ops_test.goH A D09-Nov-202011.8 KiB

predexp_test.goH A D09-Nov-202015.7 KiB

priority.goH A D09-Nov-20201.1 KiB

privilege.goH A D09-Nov-20203 KiB

query_aggregate_command.goH A D09-Nov-20204.6 KiB

query_aggregate_test.goH A D09-Nov-20203.1 KiB

query_command.goH A D09-Nov-20201.8 KiB

query_objects_command.goH A D09-Nov-20201.2 KiB

query_policy.goH A D09-Nov-2020916

query_record_command.goH A D09-Nov-20201 KiB

query_test.goH A D09-Nov-202011.4 KiB

query_validate.goH A D09-Nov-20201.7 KiB

random_operation_test.goH A D09-Nov-20203.3 KiB

read_command.goH A D09-Nov-20207.4 KiB

read_command_reflect.goH A D09-Nov-202011.9 KiB

read_header_command.goH A D09-Nov-20202.7 KiB

read_mode_ap.goH A D09-Nov-20201.2 KiB

read_mode_sc.goH A D09-Nov-20201.6 KiB

record.goH A D09-Nov-20201.6 KiB

record_exists_action.goH A D09-Nov-20201.5 KiB

recordset.goH A D09-Nov-20206 KiB

recordset_test.goH A D09-Nov-20201.1 KiB

replica_policy.goH A D09-Nov-20201.7 KiB

role.goH A D09-Nov-20201.6 KiB

scan_command.goH A D09-Nov-20201.8 KiB

scan_objects_command.goH A D09-Nov-20201.9 KiB

scan_policy.goH A D09-Nov-20201.2 KiB

scan_test.goH A D09-Nov-20206.2 KiB

security_test.goH A D09-Nov-20208.7 KiB

server_command.goH A D09-Nov-20202.6 KiB

single_command.goH A D09-Nov-20201.8 KiB

statement.goH A D09-Nov-20204.2 KiB

task.goH A D09-Nov-20202 KiB

task_drop_index.goH A D09-Nov-20201.8 KiB

task_index.goH A D09-Nov-20202.1 KiB

task_register.goH A D09-Nov-20201.8 KiB

task_remove.goH A D09-Nov-20201.8 KiB

test_utils_test.goH A D09-Nov-20202.9 KiB

touch_command.goH A D09-Nov-20203.6 KiB

truncate_test.goH A D09-Nov-20203.1 KiB

udf.goH A D09-Nov-2020211

udf_test.goH A D09-Nov-202013.3 KiB

unpacker.goH A D09-Nov-20209.4 KiB

user_roles.goH A D09-Nov-2020868

value.goH A D09-Nov-202031.6 KiB

value_helpers.goH A D09-Nov-20201.8 KiB

value_reflect.goH A D09-Nov-20201.5 KiB

value_test.goH A D09-Nov-20205.6 KiB

write_command.goH A D09-Nov-20202.7 KiB

write_policy.goH A D09-Nov-20204 KiB

README.md

1# Aerospike Go Client
2
3[![Aerospike Client Go](https://goreportcard.com/badge/github.com/aerospike/aerospike-client-go)](https://goreportcard.com/report/github.com/aerospike/aerospike-client-go)
4[![Build Status](https://travis-ci.org/aerospike/aerospike-client-go.svg?branch=master)](https://travis-ci.org/aerospike/aerospike-client-go)
5[![Godoc](https://godoc.org/github.com/aerospike/aerospike-client-go?status.svg)](https://pkg.go.dev/github.com/aerospike/aerospike-client-go)
6
7An Aerospike library for Go.
8
9This library is compatible with Go 1.9+ and supports the following operating systems: Linux, Mac OS X (Windows builds are possible, but untested).
10
11Up-to-date documentation is available in the [![Godoc](https://godoc.org/github.com/aerospike/aerospike-client-go?status.svg)](https://pkg.go.dev/github.com/aerospike/aerospike-client-go).
12
13You can refer to the test files for idiomatic use cases.
14
15Please refer to [`CHANGELOG.md`](CHANGELOG.md) for release notes, or if you encounter breaking changes.
16
17## Notice:
18
19We have released the Go Client v2, with some breaking API changes. Most changes are minor, and can be fixed with relative ease.
20
21The only major issue is that the behavior of the client when a key does not exist has changed.
22
23It used to return no error, but a `nil` `Record.Bins`. Now it returns `ErrKeyNotFound` error.
24
25This is a significant changes, and you should search your code for all instances of `Bins == nil` and adapt the code accordingly.
26
27Please refer to the [`CHANGELOG.md`](CHANGELOG.md) for details.
28
29- [Usage](#Usage)
30- [Prerequisites](#Prerequisites)
31- [Installation](#Installation)
32- [Tweaking Performance](#Performance)
33- [Benchmarks](#Benchmarks)
34- [API Documentation](#API-Documentation)
35- [Google App Engine](#App-Engine)
36- [Reflection](#Reflection)
37- [Tests](#Tests)
38- [Examples](#Examples)
39  - [Tools](#Tools)
40
41
42## Usage:
43
44The following is a very simple example of CRUD operations in an Aerospike database.
45
46```go
47package main
48
49import (
50  "fmt"
51
52  aero "github.com/aerospike/aerospike-client-go"
53)
54
55// This is only for this example.
56// Please handle errors properly.
57func panicOnError(err error) {
58  if err != nil {
59    panic(err)
60  }
61}
62
63func main() {
64  // define a client to connect to
65  client, err := aero.NewClient("127.0.0.1", 3000)
66  panicOnError(err)
67
68  key, err := aero.NewKey("test", "aerospike", "key")
69  panicOnError(err)
70
71  // define some bins with data
72  bins := aero.BinMap{
73    "bin1": 42,
74    "bin2": "An elephant is a mouse with an operating system",
75    "bin3": []interface{}{"Go", 2009},
76  }
77
78  // write the bins
79  err = client.Put(nil, key, bins)
80  panicOnError(err)
81
82  // read it back!
83  rec, err := client.Get(nil, key)
84  panicOnError(err)
85
86  // delete the key, and check if key exists
87  existed, err := client.Delete(nil, key)
88  panicOnError(err)
89  fmt.Printf("Record existed before delete? %v\n", existed)
90}
91```
92
93More examples illustrating the use of the API are located in the
94[`examples`](examples) directory.
95
96Details about the API are available in the [`docs`](docs) directory.
97
98<a name="Prerequisites"></a>
99## Prerequisites
100
101[Go](http://golang.org) version v1.12+ is required.
102
103To install the latest stable version of Go, visit
104[http://golang.org/dl/](http://golang.org/dl/)
105
106
107Aerospike Go client implements the wire protocol, and does not depend on the C client.
108It is goroutine friendly, and works asynchronously.
109
110Supported operating systems:
111
112- Major Linux distributions (Ubuntu, Debian, Red Hat)
113- Mac OS X
114- Windows (untested)
115
116<a name="Installation"></a>
117## Installation:
118
1191. Install Go 1.9+ and setup your environment as [Documented](http://golang.org/doc/code.html#GOPATH) here.
1202. Get the client in your ```GOPATH``` : ```go get github.com/aerospike/aerospike-client-go```
121  * To update the client library: ```go get -u github.com/aerospike/aerospike-client-go```
122
123Using [gopkg.in](https://gopkg.in/) is also supported: `go get -u gopkg.in/aerospike/aerospike-client-go.v1`
124
125### Some Hints:
126
127 * To run a go program directly: ```go run <filename.go>```
128 * to build:  ```go build -o <output> <filename.go>```
129  * example: ```go build -o benchmark tools/benchmark/benchmark.go```
130
131<a name="Performance"></a>
132## Performance Tweaking
133
134We are bending all efforts to improve the client's performance. In our reference benchmarks, Go client performs almost as good as the C client.
135
136To read about performance variables, please refer to [`docs/performance.md`](docs/performance.md)
137
138<a name="Tests"></a>
139## Tests
140
141This library is packaged with a number of tests. Tests require Ginkgo and Gomega library.
142
143Before running the tests, you need to update the dependencies:
144
145    $ go get .
146
147To run all the test cases with race detection:
148
149    $ ginkgo -r -race
150
151
152<a name="Examples"></a>
153## Examples
154
155A variety of example applications are provided in the [`examples`](examples) directory.
156
157<a name="Tools"></a>
158### Tools
159
160A variety of clones of original tools are provided in the [`tools`](tools) directory.
161They show how to use more advanced features of the library to re-implement the same functionality in a more concise way.
162
163<a name="Benchmarks"></a>
164## Benchmarks
165
166Benchmark utility is provided in the [`tools/benchmark`](tools/benchmark) directory.
167See the [`tools/benchmark/README.md`](tools/benchmark/README.md) for details.
168
169<a name="API-Documentation"></a>
170## API Documentation
171
172A simple API documentation is available in the [`docs`](docs/README.md) directory. The latest up-to-date docs can be found in [![Godoc](https://godoc.org/github.com/aerospike/aerospike-client-go?status.svg)](https://pkg.go.dev/github.com/aerospike/aerospike-client-go).
173
174<a name="App-Engine"></a>
175## Google App Engine
176
177To build the library for App Engine, build it with the build tag `app_engine`. Aggregation functionality is not available in this build.
178
179
180<a name="Reflection"></a>
181## Reflection, and Object API
182
183To 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.
184
185
186## License
187
188The Aerospike Go Client is made available under the terms of the Apache License, Version 2, as stated in the file `LICENSE`.
189
190Individual files may be made available under their own specific license,
191all compatible with Apache License, Version 2. Please see individual files for details.
192
193