About 185,000 results
Open links in new tab
  1. How to create a new MySQL database with go-sql-driver

    May 14, 2015 · I'm working on Golang script that automatically clone a database. I'm using go-sql-driver but i can't find in the documentation a way to create a new database. Connection to MySQL require …

  2. go - Database connection best practice - Stack Overflow

    Jul 25, 2014 · The best way is to create the database once at app start-up, and use this handle afterwards. Additionnaly, the sql.DB type is safe for concurrent use, so you don't even need mutexes …

  3. How to execute an IN lookup in SQL using Golang?

    What does Go want for the second param in this SQL query. I am trying to use the IN lookup in postgres.

  4. postgresql - What is the difference between database/sql connection ...

    Feb 21, 2023 · I'm trying to use ent on golang backed with postgresql DB. Current legacy code uses pgxpool for connection pool. But ent does not support pgx pool, and only support standard …

  5. How can I prevent SQL injection attacks in Go while using …

    Apr 22, 2015 · There is an article about this on go.dev: Avoiding SQL injection risk. You can avoid an SQL injection risk by providing SQL parameter values as sql package function arguments. Many …

  6. sql - How to log queries to database drivers? - Stack Overflow

    Mar 26, 2015 · I am trying to write a simple Database application in go which access multiple data servers, some MySQL, MSSQL and SqlLite3. I am using the "database/sql" package to …

  7. How do you handle database errors in Go without getting coupled to …

    A common way to interact with a SQL database in Go is to use the built in database/sql interface. Many different third-party packages implement this interface in a way that is specific to some particular …

  8. Efficiently mapping one-to-many many-to-many database to struct in …

    Feb 8, 2019 · Question When dealing with a one-to-many or many-to-many SQL relationship in Golang, what is the best (efficient, recommended, "Go-like") way of mapping the rows to a struct? Taking the …

  9. How to create a MySQL database (table) in Go and perform CRUD ...

    Or, if you just want to get data in MySQL, you can use the MySQL CLI to execute some statements (or run an .sql file) to set up a table and insert some data so your application can have something to …

  10. How do I batch sql statements with package database/sql

    Sep 19, 2012 · How do I batch sql statements with Go's database/sql package? In Java I would do it like this : // Create a prepared statement String sql = "INSERT INTO my_table VALUES(?)"; …