GitHubEmpezar

La referencia de API proviene de los comentarios de documentación de Go en el código fuente y está redactada en inglés.

package sqlitestore

import "github.com/nsgo-dev/game/pkg/online/leaderboard/selfhost/sqlitestore"

Resumen

Package sqlitestore is experimental: its API and documented formats may change in a minor release. See the API stability policy. keeps the self-hosted leaderboard's records in an SQLite file through the pure Go modernc.org/sqlite driver.

Índice

Funciones

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

Open opens or creates the SQLite database at path (":memory:" for one in memory) in write-ahead-log mode, migrates its leaderboard schema and returns a store over it. A path containing ? or # is refused.

func OpenReader

Solo en linux, macos, windows, android, iosCódigo fuente
func OpenReader(ctx context.Context, path string) (*sql.DB, error)

OpenReader opens a second handle on the SQLite database file at path, which Open has already opened, for work that must not queue behind the store's single connection: a service's readiness check and the counts its metrics scan. Its connections only read (query_only), and the database's write-ahead log lets them read while the store writes, so neither a long write delays them nor a full-table count delays the store. It refuses ":memory:", a database only the store's own connection sees. Close the handle when the service stops.