GitHub시작하기

API 레퍼런스는 소스 코드의 Go 문서 주석에서 추출되며 영어로 작성되어 있습니다.

package sqlitestore

import "github.com/nsgo-dev/game/pkg/accounts/sqlitestore"

전용 linux, macos, windows, android, ios

개요

Package sqlitestore opens an accounts.Store in a SQLite database file, with the pure-Go modernc.org/sqlite driver (no cgo). It suits a single account service process; several processes sharing one database should use Postgres (package pgstore).

The package builds for every target but the web: a browser has no file system to keep the database in, and the account service runs on a server.

색인

변수

var Dialect = sqlstore.Dialect{
	Name: "sqlite",
	IsUnique: func(err error) bool {
		var e *sqlite.Error
		return errors.As(err, &e) && (e.Code() == constraintUnique || e.Code() == constraintPrimaryKey)
	},
}

Dialect is SQLite's sqlstore dialect.

함수

func Open(ctx context.Context, path string) (*sqlstore.Store, error)

Open opens (creating when missing) the SQLite database at path, or a private in-memory database for ":memory:", and returns a store on it with the schema created. The database uses write-ahead logging, enforces foreign keys and waits up to five seconds for a lock another process holds.

The store uses one connection, so its statements run one at a time; SQLite serializes writes anyway. Close the store to close the database.