Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle time.Time in formatter #161

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/knadh/koanf/providers/env v0.1.0
github.com/knadh/koanf/providers/file v0.1.0
github.com/knadh/koanf/v2 v2.0.0
github.com/libsql/libsql-client-go v0.0.0-20231116081645-f094d008351e
github.com/libsql/libsql-client-go v0.0.0-20231116123136-ff4e46c3d3a1
github.com/libsql/sqlite-antlr4-parser v0.0.0-20230802215326-5cb5bb604475
github.com/mattn/go-sqlite3 v1.14.16
github.com/spf13/cobra v1.6.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ github.com/libsql/libsql-client-go v0.0.0-20231018121623-6f7c8595b727 h1:9pB6/lQ
github.com/libsql/libsql-client-go v0.0.0-20231018121623-6f7c8595b727/go.mod h1:T+1lRvREkstNW7bmF1PTiDhV6hji0mrlfZkZuk/UPhw=
github.com/libsql/libsql-client-go v0.0.0-20231116081645-f094d008351e h1:EEr6UVKHXn6hhxTbC5cLp2kvQ+9Umo3xZbFRIOnUveE=
github.com/libsql/libsql-client-go v0.0.0-20231116081645-f094d008351e/go.mod h1:T+1lRvREkstNW7bmF1PTiDhV6hji0mrlfZkZuk/UPhw=
github.com/libsql/libsql-client-go v0.0.0-20231116123136-ff4e46c3d3a1 h1:wBq6jZyliLZnM4SSvhoeLtlFwQw3mxKIqsUd/JvG6Dk=
github.com/libsql/libsql-client-go v0.0.0-20231116123136-ff4e46c3d3a1/go.mod h1:T+1lRvREkstNW7bmF1PTiDhV6hji0mrlfZkZuk/UPhw=
github.com/libsql/sqlite-antlr4-parser v0.0.0-20230802215326-5cb5bb604475 h1:6PfEMwfInASh9hkN83aR0j4W/eKaAZt/AURtXAXlas0=
github.com/libsql/sqlite-antlr4-parser v0.0.0-20230802215326-5cb5bb604475/go.mod h1:20nXSmcf0nAscrzqsXeC2/tA3KkV2eCiJqYuyAgl+ss=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
Expand Down
4 changes: 4 additions & 0 deletions internal/db/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ func formatValue(val interface{}, formatter Formatter) (string, error) {
if val == nil {
return formatter.formatNull(), nil
} else {
switch v := val.(type) {
case time.Time:
return formatter.formatDateTime(v), nil
}
rv := reflect.ValueOf(val)
switch rv.Kind() {
case reflect.Struct:
Expand Down
Loading