-1

I want to query all the values saved in the blockchain whose key starts with charcter 'O' and retrieve the list of them.

Hrishabh
  • 31
  • 5

1 Answers1

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