driver: support _time_format DSN query param

Building on the _pragma query param support added in 508747c9, support
a new _time_format query param.

If _time_format is set to "sqlite", written times use the time package
format "2006-01-02 15:04:05.999999999-07:00". This is the format
mattn/go-sqlite3 uses and is format 4 at
https://sqlite.org/lang_datefunc.html#time_values.

By default, times are formatted with time.Time.String. This maintains
compatibility with existing users of the driver.

Fixes #47
This commit is contained in:
Dan Peterson
2021-10-23 09:57:47 -03:00
parent a530c91309
commit 064df839a4
3 changed files with 110 additions and 5 deletions

View File

@@ -9,13 +9,14 @@ import (
"flag"
"fmt"
"io/ioutil"
"modernc.org/tcl"
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"testing"
"modernc.org/tcl"
)
var (
@@ -26,6 +27,10 @@ var (
)
func TestTclTest(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
blacklist := map[string]struct{}{}
switch runtime.GOARCH {
case "386", "arm":