mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 07:02:12 +08:00

* Remove dbProviderFunc function. This removes one extra indirection that made the code bit more difficult to navigate. * Remove indirection function types implementing single-method interfaces. This streamlines the code and makes it bit easier to navigate. * Update pkg/storage/unified/sql/sqltemplate/dialect_mysql.go Co-authored-by: Mustafa Sencer Özcan <32759850+mustafasencer@users.noreply.github.com> --------- Co-authored-by: Mustafa Sencer Özcan <32759850+mustafasencer@users.noreply.github.com>
30 lines
710 B
Go
30 lines
710 B
Go
package sqltemplate
|
|
|
|
// SQLite is an implementation of Dialect for the SQLite DMBS.
|
|
var SQLite = sqlite{}
|
|
|
|
type sqlite struct{}
|
|
|
|
func (s sqlite) DialectName() string {
|
|
return "sqlite"
|
|
}
|
|
|
|
func (s sqlite) Ident(i string) (string, error) {
|
|
// See:
|
|
// https://www.sqlite.org/lang_keywords.html
|
|
return standardIdent(i)
|
|
}
|
|
|
|
func (s sqlite) ArgPlaceholder(argNum int) string {
|
|
return "?"
|
|
}
|
|
|
|
func (s sqlite) SelectFor(s2 ...string) (string, error) {
|
|
return rowLockingClauseMap(nil).SelectFor(s2...)
|
|
}
|
|
|
|
func (sqlite) CurrentEpoch() string {
|
|
// Alternative approaches like `unixepoch('subsecond') * 1000000` returns millisecond precision.
|
|
return "CAST((julianday('now') - 2440587.5) * 86400000000.0 AS BIGINT)"
|
|
}
|