2020-01-23 21:53:00 +00:00
|
|
|
#!/bin/sh
|
2020-01-17 20:07:00 +00:00
|
|
|
|
2020-06-28 04:56:29 +01:00
|
|
|
dbx schema -d pgx -d pgxcockroach satellitedb.dbx .
|
|
|
|
dbx golang -d pgx -d pgxcockroach -p dbx -t templates satellitedb.dbx .
|
2020-12-14 19:52:21 +00:00
|
|
|
( printf '%s\n' '//lint:file-ignore U1000,ST1012 generated file'; cat satellitedb.dbx.go ) > satellitedb.dbx.go.tmp && mv satellitedb.dbx.go.tmp satellitedb.dbx.go
|
2020-01-17 20:07:00 +00:00
|
|
|
gofmt -r "*sql.Tx -> tagsql.Tx" -w satellitedb.dbx.go
|
2020-01-19 13:42:08 +00:00
|
|
|
gofmt -r "*sql.Rows -> tagsql.Rows" -w satellitedb.dbx.go
|
2020-01-17 20:07:00 +00:00
|
|
|
perl -0777 -pi \
|
2021-04-23 10:52:40 +01:00
|
|
|
-e 's,\t_ "github.com/jackc/pgx/v4/stdlib"\n\),\t_ "github.com/jackc/pgx/v4/stdlib"\n\n\t"storj.io/private/tagsql"\n\),' \
|
2020-01-17 20:07:00 +00:00
|
|
|
satellitedb.dbx.go
|
|
|
|
perl -0777 -pi \
|
|
|
|
-e 's/type DB struct \{\n\t\*sql\.DB/type DB struct \{\n\ttagsql.DB/' \
|
|
|
|
satellitedb.dbx.go
|
|
|
|
perl -0777 -pi \
|
|
|
|
-e 's/\tdb = &DB\{\n\t\tDB: sql_db,/\tdb = &DB\{\n\t\tDB: tagsql.Wrap\(sql_db\),/' \
|
2020-01-23 21:53:00 +00:00
|
|
|
satellitedb.dbx.go
|