This repository has been archived by the owner on May 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdialect.go
45 lines (40 loc) · 1.43 KB
/
dialect.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
* Date: 22/02/14
* Time: 11:17 AM
*/
package opal
// The Dialect interface performs sql syntax modification to conform
// to the differences in implementations of the SQL standard.
// Initially the Dialect will be made with the differences of Sqlite3
// in mind. Will be expanded in the future.
type Dialect interface {
// All identifiers will be transformed into a string
// compatible with the dialect to ensure that any keywords
// that might be used as identifiers do not cause Sql errors.
// E.g. In Sqlite if you want to use a keyword as a name,
// you need to quote it:
//
// 'keyword' A keyword in single quotes is a string
// literal.
//
// "keyword" A keyword in double-quotes is an identifier.
//
// [keyword] A keyword enclosed in square brackets is an
// identifier. This is not standard SQL. This quoting
// mechanism is used by MS Access and SQL Server and
// is included in SQLite for compatibility.
//
// `keyword` A keyword enclosed in grave accents (ASCII
// code 96) is an identifier. This is not standard SQL.
// This quoting mechanism is used by MySQL and is
// included in SQLite for compatibility.
//
// Sqlite enforces quoted string literals as identifiers based on
// context
EncodeIdentifier(pIdentifier string) string
TransformTypeDeclaration(pColumn Column) string
}
type DialectEncoder (func(string) string)
// Sqlite3 implements the Dialect interface
type DefaultDialect struct {
}