web:
image: nginx
volumes:
- "./app:/src/app"
ports:
- "3030:3000"
- "35729:35729"
Run Code Online (Sandbox Code Playgroud)
我想有一个bash脚本用bash脚本替换nginxfor参数.
./script apache
Run Code Online (Sandbox Code Playgroud)
将替换nginx为apache
我开始用这种方式:
describe "DELETE /v1/categories/{id}" do
before(:each) do
# Login User/Token
end
it 'deletes a category' do
category = Fabricate(:category)
category2 = Fabricate(:category)
get "/v1/categories"
expect(response.status).to eq 200
expect(JSON.parse(response.body)).to eq([YAML.load(category.to_json),YAML.load(category2.to_json),])
delete "/v1/categories/#{category.id}"
expect(response.status).to eq 200
get "/v1/categories"
expect(JSON.parse(response.body)).to eq([YAML.load(category2.to_json)])
end
end
Run Code Online (Sandbox Code Playgroud)
我不确定是否是测试API请求删除数据的最佳方法.
What's the best way to convert the type sqlx.DB (jmoiron/sqlx) to sql.DB (database/sql)?
I'm currently using the package github.com/golang-migrate/migrate and it requires an existing connection to follow sql.DB interface.
func Migrate(db *sqlx.DB) error {
driver, err := postgres.WithInstance(db, &postgres.Config{})
m, err := migrate.NewWithDatabaseInstance(
"file://src/db/migrations",
"postgres", driver)
if err != nil {
return err
}
return m.Up()
}
Run Code Online (Sandbox Code Playgroud)
Update: I mixed the description and added more details. The title was correct.