sqlliteKit

package
v3.0.94 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGormDB

func NewGormDB(dsn string, poolConfig *gormKit.PoolConfig, opts ...gorm.Option) (*gorm.DB, error)

NewGormDB

@param dsn DSN(Data Source Name),它是用于指定数据库文件路径以及可能的其他选项的字符串.

e.g. 	内存数据库
	":memory:"
	// "file::memory:"	表示SQLite应创建一个仅存在于内存中的临时数据库。这意味着当SQLite连接关闭时,这个数据库的内容将不会被保存到磁盘上,它只在当前进程的上下文中存在。
	// "?cache=shared"	是SQLite的一个特定选项,它指定了内存数据库应该启用共享缓存模式。在默认情况下,每个SQLite连接都会有自己的私有缓存,而设置为shared后,多个连接可以共享同一份缓存数据。这意味着对于同一个数据库的不同连接,读取的数据会保持一致,并且能减少内存使用量。这对于多线程或多进程环境下使用内存数据库非常有用,各个进程可以通过SQLite API安全地共享和访问相同的内存数据库内容。
	"file::memory:?cache=shared"
e.g.1	本地SQLite数据库文件
	"./my_database.db"
	"/path/to/your/database.sqlite"
	"file:/path/to/your/database.sqlite?_loc=Local"

Types

This section is empty.

Jump to

Keyboard shortcuts

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