You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
432 B
Go
21 lines
432 B
Go
2 years ago
|
package main
|
||
|
|
||
|
import (
|
||
|
"zombiezen.com/go/sqlite"
|
||
|
"zombiezen.com/go/sqlite/sqlitex"
|
||
|
)
|
||
|
|
||
|
func createDB() (*sqlite.Conn, error) {
|
||
|
// Open an in-memory database.
|
||
|
conn, err := sqlite.OpenConn(":memory:", sqlite.OpenReadWrite)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
// Create tables
|
||
|
sqlitex.ExecScript(conn, `
|
||
|
CREATE TABLE stations (id text primary key, name text, lat real, lon real);
|
||
|
`)
|
||
|
// Return connection
|
||
|
return conn, nil
|
||
|
}
|