Documentation
¶
Overview ¶
Package sqlite 提供 SQLite 数据库驱动接入(纯 Go 实现, 无需 cgo)。
本包为可选驱动: 业务项目仅当 import 本包时才会拉取 github.com/glebarez/sqlite 及其依赖, 未使用的驱动(mysql/postgres 等)不会进入业务项目的依赖树。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SQLite ¶
type SQLite struct {
database.DatabasePool // 数据库连接池配置
LoggerLevel string `yaml:"logger_level" toml:"logger_level" json:"logger_level" mapstructure:"logger_level"` // 日志级别: silent, warn, warning, info, error
Path string `yaml:"path" toml:"path" json:"path" mapstructure:"path"` // 数据库文件路径: data.db, ":memory:" 为内存库
}
SQLite 数据库配置
SQLite 为单文件嵌入式数据库, 无主机/端口/账号等网络概念; 且采用单写者模型, 高并发写入场景建议将连接池 MaxOpenConns 设为 1, 避免出现 database is locked。
Click to show internal directories.
Click to hide internal directories.