package main import ( "github.com/aerospike/aerospike-client-go" ) func main() { client, _ := aerospike.NewClient("localhost", 3000) key, _ := aerospike.NewKey("test", "demo", "user123") bins := aerospike.BinMap{ "name": "John Doe", "age": 30, "gender": "Male", } policy := aerospike.NewWritePolicy(0, 0) binsToWrite := aerospike.NewBinMapBins(bins) err := client.PutBins(policy, key, binsToWrite) if err != nil { panic(err) } }
package main import ( "github.com/aerospike/aerospike-client-go" ) func main() { client, _ := aerospike.NewClient("localhost", 3000) key, _ := aerospike.NewKey("test", "demo", "user123") bin1 := aerospike.NewBin("name", "John Doe") bin2 := aerospike.NewBin("age", 30) bin3 := aerospike.NewBin("gender", "Male") policy := aerospike.NewWritePolicy(0, 0) err := client.PutBins(policy, key, bin1, bin2, bin3) if err != nil { panic(err) } }In this example, we are using the `NewBin` method to create individual bins and then passing them as parameters to the `PutBins` method along with the key and policy. Overall, `Client.PutBins` is used to write key-value pairs to a record in the Aerospike database. It takes various input parameters including a write policy and can accept individual bins or a `BinMap`. This function is part of the `github.com/aerospike/aerospike-client-go` package library.