giteabot backport / giteabot (push) Canceled after 0s
giteabot / giteabot (push) Canceled after 0s
release-nightly / nightly-binary (push) Canceled after 0s
release-nightly / nightly-container (push) Canceled after 0s
cache-seeder / gobuild (push) Canceled after 0s
cache-seeder / lint (bindata, lint-backend) (push) Canceled after 0s
release-nightly-snapcraft / build-and-publish (push) Canceled after 0s
Includes direct password setup links in registration emails. Assisted-by: Codex:GPT-5
32 lines
816 B
Go
32 lines
816 B
Go
// Copyright 2026 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
//go:build sqlite_mattn && sqlite_unlock_notify
|
|
|
|
package db
|
|
|
|
import (
|
|
"fmt"
|
|
"strconv"
|
|
"strings"
|
|
|
|
_ "github.com/mattn/go-sqlite3"
|
|
)
|
|
|
|
func init() {
|
|
registerSQLiteConnStrMaker(makeSQLiteConnStrMattnCGO)
|
|
}
|
|
|
|
func makeSQLiteConnStrMattnCGO(opts SQLiteConnStrOptions) (string, string, error) {
|
|
var params []string
|
|
params = append(params, "cache=shared")
|
|
params = append(params, "mode=rwc")
|
|
params = append(params, "_busy_timeout="+strconv.Itoa(opts.BusyTimeout))
|
|
params = append(params, "_txlock=immediate")
|
|
if opts.JournalMode != "" {
|
|
params = append(params, "_journal_mode="+opts.JournalMode)
|
|
}
|
|
connStr := fmt.Sprintf("file:%s?%s", opts.FilePath, strings.Join(params, "&"))
|
|
return sqlDriverSQLite3, connStr, nil
|
|
}
|