Пример #1
0
/**
 * Check existence of records in one batch.
 */
func batchExists(
	client *as.Client,

	keyPrefix string,
	size int,
) {
	// Batch into one call.
	keys := make([]*as.Key, size)
	for i := 0; i < size; i++ {
		keys[i], _ = as.NewKey(*shared.Namespace, *shared.Set, keyPrefix+strconv.Itoa(i+1))
	}

	existsArray, err := client.BatchExists(nil, keys)
	shared.PanicOnError(err)

	for i := 0; i < len(existsArray); i++ {
		key := keys[i]
		exists := existsArray[i]
		log.Printf("Record: ns=%s set=%s key=%s exists=%s",
			key.Namespace(), key.SetName(), key.Value(), exists)
	}
}