-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdriver.go
51 lines (38 loc) · 1.06 KB
/
driver.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
46
47
48
49
50
51
package ydb
import (
"context"
"time"
ydb "github.com/ydb-platform/ydb-go-sdk/v3"
"gorm.io/gorm"
"github.com/ydb-platform/gorm-driver/internal/dialect"
)
type Option = dialect.Option
func With(opts ...ydb.Option) Option {
return dialect.With(opts...)
}
func WithTablePathPrefix(tablePathPrefix string) Option {
return dialect.WithTablePathPrefix(tablePathPrefix)
}
func WithMaxOpenConns(n int) Option {
return dialect.WithMaxOpenConns(n)
}
func WithMaxIdleConns(n int) Option {
return dialect.WithMaxIdleConns(n)
}
func WithConnMaxIdleTime(d time.Duration) Option {
return dialect.WithConnMaxIdleTime(d)
}
type QueryMode = ydb.QueryMode
const (
DataQueryMode = ydb.DataQueryMode
ExplainQueryMode = ydb.ExplainQueryMode
ScanQueryMode = ydb.ScanQueryMode
SchemeQueryMode = ydb.SchemeQueryMode
ScriptingQueryMode = ydb.ScriptingQueryMode
)
func WithQueryMode(ctx context.Context, mode QueryMode) context.Context {
return ydb.WithQueryMode(ctx, mode)
}
func Open(dsn string, opts ...Option) gorm.Dialector {
return dialect.New(dsn, opts...)
}