Lix provides a powerful SQL-based query interface for interacting with the underlying database. This approach gives you full flexibility when working with your data while maintaining type safety.
The Lix database is built on SQLite (running in WebAssembly in the browser) and uses Kysely as a type-safe SQL query builder. This means you can leverage both the power of SQL and TypeScript's type system.
You can access the database through the db
property of your Lix instance:
Many fields in Lix store JSON data. You can query inside JSON values using SQLite's JSON functions:
For complex queries that are difficult to express with the query builder, you can use raw SQL:
For operations that need to be atomic, you can use transactions: