package
3.0.4
Repository: https://github.com/keepchen/go-sail.git
Documentation: pkg.go.dev

# Functions

GetInstance 获取数据库实例 获取由InitDB实例化后的连接.
Init 初始化数据库连接 InitDB 的语法糖.
InitDB 初始化数据库连接.
New 初始化化全新的数据库链接 rInstance为读实例,wInstance为写实例.
NewFreshDB 实例化全新的数据库链接 rInstance为读实例,wInstance为写实例.
No description provided by the author

# Constants

数据库类型标识:clickhouse.
数据库类型标识:mysql.
数据库类型标识:postgres sql.
数据库类型标识:sqlite.
数据库类型标识:sqlserver.

# Structs

No description provided by the author
ClickhouseConfItem clickhouse配置.
Conf 配置信息 <yaml example> db_conf: enable: false driver_name: mysql auto_migrate: true log_level: warn connection_pool: # 最大开启连接数 max_open_conn_count: 100 # 最大闲置数量 max_idle_conn_count: 10 # 连接最大存活时间(分钟) conn_max_life_time_minutes: 30 # 连接最大空闲时间(分钟) conn_max_idle_time_minutes: 10 mysql: read: host: 127.0.0.1 port: 33060 username: foo password: bar database: go_sail charset: utf8mb4 parseTime: true loc: Local write: host: 127.0.0.1 port: 33060 username: foo password: bar database: go_sail charset: utf8mb4 parseTime: true loc: Local <toml example> # ::数据库配置:: [db_conf] enable = false driver_name = "mysql" # 是否自动同步表结构 auto_migrate = false # 日志级别 silent | info | warn | error log_level = "info" # ::数据库连接池配置:: [db_conf.connection_pool] # 最大开启连接数 max_open_conn_count = 100 # 最大闲置数量 max_idle_conn_count = 10 # 连接最大存活时间(分钟) conn_max_life_time_minutes = 30 # 连接最大空闲时间(分钟) conn_max_idle_time_minutes = 10 # mysql配置 [db_conf.mysql.read] host = "localhost" port = 3306 username = "foo" password = "bar" database = "default" charset = "utf8mb4" parse_time = true loc = "Local" [db_conf.mysql.write] host = "localhost" port = 3306 username = "foo" password = "bar" database = "go_sail" charset = "utf8mb4" parse_time = true loc = "Local" # postgres配置 [db_conf.postgres.read] host = "localhost" port = 9920 username = "foo" password = "bar" database = "go_sail" ssl_mode = "disable" # enable | disable timezone = "Asia/Shanghai" # postgres配置 [db_conf.postgres.write] host = "localhost" port = 9920 username = "foo" password = "bar" database = "go_sail" ssl_mode = "disable" # enable | disable timezone = "Asia/Shanghai" # sqlserver配置 [db_conf.sqlserver.read] host = "localhost" port = 9930 username = "foo" password = "bar" database = "go_sail" [db_conf.sqlserver.write] host = "localhost" port = 9930 username = "foo" password = "bar" database = "go_sail" # clickhouse配置 [db_conf.clickhouse.read] host = "localhost" port = 9000 username = "foo" password = "bar" database = "go_sail" read_timeout = 20 write_timeout = 20 [db_conf.clickhouse.write] host = "localhost" port = 9000 username = "foo" password = "bar" database = "go_sail" read_timeout = 20 write_timeout = 20 # sqlite配置 [db_conf.sqlite.read] file = "sqlite.db" [db_conf.sqlite.write] file = "sqlite.db".
ConnectionPoolConf 连接池配置.
No description provided by the author
No description provided by the author
MysqlConfItem mysql配置.
No description provided by the author
PostgresConfItem postgres配置.
No description provided by the author
SqliteConfItem sqlite配置.
No description provided by the author
SqlserverConfItem sqlserver配置.
No description provided by the author