forked from mirror/go-sqlite3
46 lines
1.3 KiB
Go
46 lines
1.3 KiB
Go
// Copyright (C) 2018 The Go-SQLite3 Authors.
|
|
//
|
|
// Use of this source code is governed by an MIT-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// +build cgo
|
|
|
|
package sqlite3
|
|
|
|
/*
|
|
#ifndef USE_LIBSQLITE3
|
|
#include <sqlite3-binding.h>
|
|
#else
|
|
#include <sqlite3.h>
|
|
#endif
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
*/
|
|
import "C"
|
|
|
|
// SQLiteTimestampFormats is timestamp formats understood by both this module
|
|
// and SQLite. The first format in the slice will be used when saving time
|
|
// values into the database. When parsing a string from a timestamp or datetime
|
|
// column, the formats are tried in order.
|
|
var SQLiteTimestampFormats = []string{
|
|
// By default, store timestamps with whatever timezone they come with.
|
|
// When parsed, they will be returned with the same timezone.
|
|
"2006-01-02 15:04:05.999999999-07:00",
|
|
"2006-01-02T15:04:05.999999999-07:00",
|
|
"2006-01-02 15:04:05.999999999",
|
|
"2006-01-02T15:04:05.999999999",
|
|
"2006-01-02 15:04:05",
|
|
"2006-01-02T15:04:05",
|
|
"2006-01-02 15:04",
|
|
"2006-01-02T15:04",
|
|
"2006-01-02",
|
|
}
|
|
|
|
// Version returns SQLite library version information.
|
|
func Version() (libVersion string, libVersionNumber int, sourceID string) {
|
|
libVersion = C.GoString(C.sqlite3_libversion())
|
|
libVersionNumber = int(C.sqlite3_libversion_number())
|
|
sourceID = C.GoString(C.sqlite3_sourceid())
|
|
return libVersion, libVersionNumber, sourceID
|
|
}
|