oceanbase

Форк
0
59 строк · 1.1 Кб
1
// Code generated by entc, DO NOT EDIT.
2

3
package ent
4

5
import (
6
	"entgo.io/ent"
7
	"entgo.io/ent/dialect"
8
)
9

10
// Option function to configure the client.
11
type Option func(*config)
12

13
// Config is the configuration for the client and its builder.
14
type config struct {
15
	// driver used for executing database requests.
16
	driver dialect.Driver
17
	// debug enable a debug logging.
18
	debug bool
19
	// log used for logging on debug mode.
20
	log func(...interface{})
21
	// hooks to execute on mutations.
22
	hooks *hooks
23
}
24

25
// hooks per client, for fast access.
26
type hooks struct {
27
	ObCluster []ent.Hook
28
}
29

30
// Options applies the options on the config object.
31
func (c *config) options(opts ...Option) {
32
	for _, opt := range opts {
33
		opt(c)
34
	}
35
	if c.debug {
36
		c.driver = dialect.Debug(c.driver, c.log)
37
	}
38
}
39

40
// Debug enables debug logging on the ent.Driver.
41
func Debug() Option {
42
	return func(c *config) {
43
		c.debug = true
44
	}
45
}
46

47
// Log sets the logging function for debug mode.
48
func Log(fn func(...interface{})) Option {
49
	return func(c *config) {
50
		c.log = fn
51
	}
52
}
53

54
// Driver configures the client driver.
55
func Driver(driver dialect.Driver) Option {
56
	return func(c *config) {
57
		c.driver = driver
58
	}
59
}
60

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.