Documentation ¶
Overview ¶
Package sqlite is responsible for creation of encrypted sqlite3 database using sqlcipher driver. It is optimized for mobile usage as well.
sqlite package also provides a capability to apply bindata migration. You can keep your migrations close to your business logic and use this package to create an encrypted sqlite3 database and then apply the migrations easily.
Index ¶
- Constants
- func ApplyAdHocMigrations(version uint, dirty bool, m *migrate.Migrate, db *sql.DB) error
- func FixCommunitiesMigration(version uint, dirty bool, m *migrate.Migrate, db *sql.DB) error
- func Migrate(database *sql.DB) error
- func Open(path, key string, kdfIterationNumber int) (*sql.DB, error)
- func OpenInMemory() (*sql.DB, error)
- func OpenWithIter(path, key string, kdfIter int) (*sql.DB, error)
- func ReplayLastMigration(version uint, m *migrate.Migrate) error
- type MigrationConfig
Constants ¶
const InMemoryPath = ":memory:"
const ReducedKDFIterationsNumber = 3200
The reduced number of kdf iterations (for performance reasons) which is currently used for derivation of the database key https://github.com/status-im/status-go/pull/1343 https://notes.status.im/i8Y_l7ccTiOYq09HVgoFwA
Variables ¶
This section is empty.
Functions ¶
func ApplyAdHocMigrations ¶ added in v0.67.1
func FixCommunitiesMigration ¶ added in v0.67.1
FixCommunitiesMigration fixes an issue with a released migration In some instances if it was interrupted the migration would be skipped but marked as completed. What we do here is that we check whether we are at that migration, if so we check that the communities table is present, if not we re-run that migration.
func Open ¶
Open opens or initializes a new database for a given file path. MigrationConfig is optional but if provided migrations are applied automatically.
func OpenInMemory ¶
OpenInMemory opens an in memory SQLite database. Number of KDF iterations is reduced to 0.
func OpenWithIter ¶
OpenWithIter allows to open a new database with a custom number of kdf iterations. Higher kdf iterations number makes it slower to open the database.