-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoracle.go
43 lines (34 loc) · 1.08 KB
/
oracle.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
package oracle
import (
_ "github.com/sijms/go-ora/v2"
"gorm.io/gorm"
)
type Config struct {
DriverName string
DSN string
ServerVersion string
Conn gorm.ConnPool
SkipInitializeWithVersion bool
DefaultStringSize uint
DontSupportRenameIndex bool
DontSupportRenameColumn bool
DontSupportNullAsDefaultValue bool
// DontSupportIdentity 为 true 时表明不支持 IDENTITY 关键字
// See: https://docs.oracle.com/database/121/DRDAA/migr_tools_feat.htm#DRDAA109
supportIdentity bool
// supportOffsetFetch 为 true 时支持 OFFSET ... FETCH ... 子句
// See:
// - https://docs.oracle.com/database/121/SQLRF/statements_10002.htm#SQLRF55636
// - https://support.oracle.com/knowledge/Oracle%20Database%20Products/1600130_1.html#GOAL
supportOffsetFetch bool
}
func Open(dsn string) gorm.Dialector {
return &Dialector{Config: (&Config{DSN: dsn}).applyEnv()}
}
func New(config Config) gorm.Dialector {
return &Dialector{Config: (&config).applyEnv()}
}
func (c *Config) applyEnv() *Config {
// TODO: apply exists env
return c
}