scylladb / gocql

Package gocql implements a fast and robust ScyllaDB client for the Go programming language.
https://docs.scylladb.com/stable/using-scylla/drivers/cql-drivers/scylla-go-driver.html
BSD 3-Clause "New" or "Revised" License
178 stars 56 forks source link

Prepared Statement Example #236

Open montu1996 opened 3 weeks ago

montu1996 commented 3 weeks ago

Can someone shared how to use prepared statement with golang driver ?

dkropachev commented 3 weeks ago

It is done automatically, every connection (Conn) contains cache of prepared statements, if your query contains select, insert, update, delete or batch it will be prepared before execution, cached and reused for any query with the sameQuery.stmt on the same connection (Conn). If you feel that it does not match your use case, feel free to outline it and let's start discussion on how to address it. Also let me know if this implementation is okay with you so that I could close an issue.