samples icon indicating copy to clipboard operation
samples copied to clipboard

no samples about state management, such as redis, postgres.

Open uestczz opened this issue 2 years ago • 4 comments

no samples about state management, such as redis, postgres. so should I just refer to the docs of dapr? and I just use the dapr.NewClient() to do so. In the sample of output and input with kafka, I find the code _, err := ctx.Send("target", greeting). so can I use the inovation of this style in redis, postgres crud?

uestczz avatar Jul 19 '23 03:07 uestczz

Currently, the Go functions do not support this feat. You can try the Java function to use the state management feat via dapr client directly.

tpiperatgod avatar Jul 19 '23 03:07 tpiperatgod

Currently, the Go functions do not support this feat. You can try the Java function to use the state management feat via dapr client directly.

it may be disappointing and surprising information, because dapr already support go client of state management. withou state management feat, the function may be trivial for me. in my senarios, only go, nodejs and python is available, and I intend to use redis, mongo, postgres and pulsar in function. so does only java support state management, and are all the resources i referred to supported in openfunction? maybe we should write these informations in our docs.

uestczz avatar Jul 19 '23 03:07 uestczz

There are java samples here https://github.com/OpenFunction/java-samples/blob/main/src/main/java/dev/openfunction/samples/StateStore.java#L57

We'll add go samples later @wanjunlei @wrongerror

benjaminhuo avatar Jul 19 '23 05:07 benjaminhuo

python function can also support state management but now the release of the python function builder is still in processing... these's an issue that needs to be solved

node function has already merged the feat pr: https://github.com/OpenFunction/functions-framework-nodejs/pull/189

for the go function, the way to use dapr client is to provide a method like GetDaprClient() to get the https://github.com/OpenFunction/functions-framework-go/blob/main/context/context.go#L270 property.

tpiperatgod avatar Jul 19 '23 05:07 tpiperatgod