hi,
Im playing around with MySQL and testing .
i wounder if thire is a way to load the entire sql file ?
The closest that i got is to use (LoadData)[https://github.com/go-sql-driver/mysql/blob/master/infile.go] In order to insert into the datbase.
评论:
mvpmvh:
nathj07:Like this? https://github.com/smotes/purse
Do you mean for creating a test db or for inserting test data? In that case what we do is use a SQL file to define the schema and os.Exec to run the db command line tools. Them each test can insert the golden data it needs.
In between tests we can them either drop the db or truncate it.
The purse library looks clever but I fear keeping queries elsewhere will lead to cognitive overhead during dev, review and maintenance.
