I want to query all the values saved in the blockchain whose key starts with charcter 'O' and retrieve the list of them.
Asked
Active
Viewed 352 times
1 Answers
1
Maybe you are trying to create an pattern for the key and retrieve that. Try to use the CompositeKey functions.
You can set "O" to be your first key then retrieve by that.
key, err := stub.CreateCompositeKey(index, []string{key1, key2, key3})
// Skiped
stub.PutState(key, value)
And to retrieve:
getStateByPartialCompositeKey(objectType, attributes)

Rodolfo Leal
- 527
- 5
- 15