mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
chore: Initial database scaffolding (#2)
* chore: Initial database scaffolding This implements migrations and code generation for interfacing with a PostgreSQL database. A dependency is added for the "postgres" binary on the host, but that seems like an acceptable requirement considering it's our primary database. An in-memory database object can be created for simple cross-OS and fast testing. * Run tests in CI * Use Docker instead of binaries on the host * Skip database tests on non-Linux operating systems * chore: Add golangci-lint and codecov * Use consistent file names
This commit is contained in:
19
database/db_memory.go
Normal file
19
database/db_memory.go
Normal file
@ -0,0 +1,19 @@
|
||||
package database
|
||||
|
||||
import "context"
|
||||
|
||||
// NewInMemory returns an in-memory store of the database.
|
||||
func NewInMemory() Store {
|
||||
return &memoryQuerier{}
|
||||
}
|
||||
|
||||
type memoryQuerier struct{}
|
||||
|
||||
// InTx doesn't rollback data properly for in-memory yet.
|
||||
func (q *memoryQuerier) InTx(ctx context.Context, fn func(Store) error) error {
|
||||
return fn(q)
|
||||
}
|
||||
|
||||
func (q *memoryQuerier) ExampleQuery(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user