sqlite

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 4 Imported by: 0

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。

func (*SQLite) Connect

func (s *SQLite) Connect() error

Connect 连接数据库

func (*SQLite) DSN

func (s *SQLite) DSN() string

DSN 数据库连接字符串

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL