Files
Georges Chaudy d999b415df UniStore: Use epoch with microsecond resolution as RV (#92638)
* Use epoch with microsecond resolution as RV

* fix backend tests

* Add solution for when the clock goes back

* Add solution for when the clock goes back

* generate mocks

* go lint

* remove comment

* Use Greatest instead of max in msyql and postgres

* update tests

* Update pkg/storage/unified/sql/sqltemplate/dialect_sqlite.go

Co-authored-by: Diego Augusto Molina <diegoaugustomolina@gmail.com>

* cast to bigint

* add additional round trip

* increment the RV using 2 sql round trips instead of 3

* cleanup comments

* cast unix timestamp to integer

* fix postgres query

* remove old increment test data

* remove greatest

* cast unix_timestamp to signed

* Use statement_timestamp instead of clock_timestamp

---------

Co-authored-by: Diego Augusto Molina <diegoaugustomolina@gmail.com>
2024-10-11 12:11:33 +03:00

24 lines
549 B
Go

package sqltemplate
// SQLite is an implementation of Dialect for the SQLite DMBS.
var SQLite = sqlite{
argPlaceholderFunc: argFmtSQL92,
name: "sqlite",
}
var _ Dialect = SQLite
type sqlite struct {
// See:
// https://www.sqlite.org/lang_keywords.html
standardIdent
rowLockingClauseMap
argPlaceholderFunc
name
}
func (sqlite) CurrentEpoch() string {
// Alternative approaches like `unixepoch('subsecond') * 1000000` returns millisecond precision.
return "CAST((julianday('now') - 2440587.5) * 86400000000.0 AS BIGINT)"
}