func createIndex(c *driver.Client, ns, set string) error { task, err := c.CreateIndex(nil, ns, set, set, urlField, driver.STRING) if err != nil { if err.Error() == "Index already exists" { return nil } return err } return <-task.OnComplete() }
// InitServiceTable initializes the indices for the service table. func InitServiceTable(as *aerospike.Client) error { bin := "Env" task, err := as.CreateIndex( nil, leverOSNamespace, serviceSet, serviceSet+bin, bin, aerospike.STRING) if err != nil { return err } err, isErr := <-task.OnComplete() if isErr && err != nil { return err } return nil }