Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create index for storage/sqlite3 #91

Merged
merged 4 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
extra option to set MaxOpenConns/MaxIdleConns for sqlite3 storage
  • Loading branch information
mattn committed Sep 30, 2023
commit 87f4a8e443d1ab4680bd9ea20d1d6f1184f4a9da
4 changes: 2 additions & 2 deletions storage/sqlite3/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ func (b *SQLite3Backend) Init() error {
return err
}

// sqlx default is 0 (unlimited), while sqlite3 by default accepts up to 100 connections
db.SetMaxOpenConns(80)
db.SetMaxOpenConns(b.MaxOpenConns)
db.SetMaxIdleConns(b.MaxIdleConns)

db.Mapper = reflectx.NewMapperFunc("json", sqlx.NameMapper)
b.DB = db
Expand Down
4 changes: 3 additions & 1 deletion storage/sqlite3/sqlite3.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ import (

type SQLite3Backend struct {
*sqlx.DB
DatabaseURL string
DatabaseURL string
MaxOpenConns int
MaxIdleConns int
}