Skip to content

Commit

Permalink
chore: bump go version
Browse files Browse the repository at this point in the history
  • Loading branch information
marcboeker committed Aug 15, 2024
1 parent 98252c7 commit 3f2e25f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
go-version: "1.23"
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
version: latest

2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
go: ["1.22"]
go: ["1.23"]
fail-fast: false

steps:
Expand Down
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ defer db.Close()
This creates an in-memory instance of DuckDB. To open a persistent database, you need to specify a filepath to the database file. If
the file does not exist, then DuckDB creates it.


```go
db, err := sql.Open("duckdb", "/path/to/foo.db")
if err != nil {
...
...
}
defer db.Close()
```
Expand All @@ -46,7 +45,7 @@ if err != nil {
defer db.Close()
```

Alternatively, you can use [sql.OpenDB](https://cs.opensource.google/go/go/+/refs/tags/go1.22.6:src/database/sql/sql.go;l=814). That way, you can perform initialization steps in a callback function before opening the database.
Alternatively, you can use [sql.OpenDB](https://cs.opensource.google/go/go/+/refs/tags/go1.23.0:src/database/sql/sql.go;l=855). That way, you can perform initialization steps in a callback function before opening the database.
Here's an example that installs and loads the JSON extension when opening a database with `sql.OpenDB(connector)`.

```go
Expand Down Expand Up @@ -79,6 +78,7 @@ Please refer to the [database/sql](https://godoc.org/database/sql) documentation
DuckDB lives in-process. Therefore, all its memory lives in the driver. All allocations live in the host process, which
is the Go application. Especially for long-running applications, it is crucial to call the corresponding `Close`-functions as specified
in [database/sql](https://godoc.org/database/sql). The following is a list of examples.

```go
db, err := sql.Open("duckdb", "")
defer db.Close()
Expand All @@ -105,27 +105,27 @@ If you want to use the [DuckDB Appender API](https://duckdb.org/docs/data/append
```go
connector, err := duckdb.NewConnector("test.db", nil)
if err != nil {
...
...
}
defer connector.Close()

conn, err := connector.Connect(context.Background())
if err != nil {
...
...
}
defer conn.Close()

// obtain an appender from the connection
// NOTE: the table 'test_tbl' must exist in test.db
appender, err := NewAppenderFromConn(conn, "", "test_tbl")
if err != nil {
...
...
}
defer appender.Close()

err = appender.AppendRow(...)
if err != nil {
...
...
}
```

Expand All @@ -136,25 +136,25 @@ If you want to use the [DuckDB Arrow Interface](https://duckdb.org/docs/api/c/ap
```go
connector, err := duckdb.NewConnector("", nil)
if err != nil {
...
...
}
defer connector.Close()

conn, err := connector.Connect(context.Background())
if err != nil {
...
...
}
defer conn.Close()

// obtain the Arrow from the connection
arrow, err := duckdb.NewArrowFromConn(conn)
if err != nil {
...
...
}

rdr, err := arrow.QueryContext(context.Background(), "SELECT * FROM generate_series(1, 10)")
if err != nil {
...
...
}
defer rdr.Release()

Expand Down Expand Up @@ -201,7 +201,7 @@ DYLD_LIBRARY_PATH=/path/to/libs ./main
`TIMESTAMP vs. TIMESTAMP_TZ`

In the C API, DuckDB stores both `TIMESTAMP` and `TIMESTAMP_TZ` as `duckdb_timestamp`, which holds the number of
microseconds elapsed since January 1, 1970 UTC (i.e., an instant without offset information).
When passing a `time.Time` to go-duckdb, go-duckdb transforms it to an instant with `UnixMicro()`,
even when using `TIMESTAMP_TZ`. Later, scanning either type of value returns an instant, as SQL types do not model
microseconds elapsed since January 1, 1970 UTC (i.e., an instant without offset information).
When passing a `time.Time` to go-duckdb, go-duckdb transforms it to an instant with `UnixMicro()`,
even when using `TIMESTAMP_TZ`. Later, scanning either type of value returns an instant, as SQL types do not model
time zone information for individual values.

0 comments on commit 3f2e25f

Please sign in to comment.