ebEntity<
TB>(entityType?:TB): {equals: (eb:ExpressionBuilder<LixDatabaseSchema,TB>) =>ExpressionWrapper<LixDatabaseSchema,TB,SqlBool>;hasLabel: (eb:ExpressionBuilder<LixDatabaseSchema,TB>) =>ExpressionWrapper<LixDatabaseSchema,TB,SqlBool>;in: (eb:ExpressionBuilder<LixDatabaseSchema,TB>) =>ExpressionWrapper<LixDatabaseSchema,TB,SqlBool>; }
Entity Expression Builder - provides fluent API for entity operations in queries.
This allows for more readable query syntax like: .where(ebEntity("file").hasLabel({ name: "important" })) .where(ebEntity("state").equals(userAccount)) .where(ebEntity().in(entities)) // When context is unambiguous (no joins)
| Type Parameter | Default type |
|---|---|
TB extends "state" | "state_by_version" | "state_history" | "commit" | "change_set" | "change_set_element" | "commit_edge" | "log" | "stored_schema" | "key_value" | "account" | "active_account" | "change_author" | "label" | "entity_label" | "entity_conversation" | "conversation" | "conversation_message" | "change_proposal" | "file" | "file_by_version" | "file_history" | "change" | "key_value_by_version" | "key_value_history" | "account_by_version" | "account_history" | "change_set_by_version" | "change_set_history" | "change_set_element_by_version" | "change_set_element_history" | "change_author_by_version" | "change_author_history" | "label_by_version" | "label_history" | "entity_label_by_version" | "entity_label_history" | "entity_conversation_by_version" | "entity_conversation_history" | "stored_schema_by_version" | "stored_schema_history" | "log_by_version" | "log_history" | "conversation_by_version" | "conversation_history" | "conversation_message_by_version" | "conversation_message_history" | "change_proposal_by_version" | "change_proposal_history" | "version" | "version_by_version" | "version_history" | "commit_by_version" | "commit_history" | "commit_edge_by_version" | "commit_edge_history" | "directory" | "active_version" | "state_with_tombstones" | "directory_by_version" | "directory_history" | "state" | "state_by_version" | "state_history" | "commit" | "change_set" | "change_set_element" | "commit_edge" | "log" | "stored_schema" | "key_value" | "account" | "active_account" | "change_author" | "label" | "entity_label" | "entity_conversation" | "conversation" | "conversation_message" | "change_proposal" | "file" | "file_by_version" | "file_history" | "change" | "key_value_by_version" | "key_value_history" | "account_by_version" | "account_history" | "change_set_by_version" | "change_set_history" | "change_set_element_by_version" | "change_set_element_history" | "change_author_by_version" | "change_author_history" | "label_by_version" | "label_history" | "entity_label_by_version" | "entity_label_history" | "entity_conversation_by_version" | "entity_conversation_history" | "stored_schema_by_version" | "stored_schema_history" | "log_by_version" | "log_history" | "conversation_by_version" | "conversation_history" | "conversation_message_by_version" | "conversation_message_history" | "change_proposal_by_version" | "change_proposal_history" | "version" | "version_by_version" | "version_history" | "commit_by_version" | "commit_history" | "commit_edge_by_version" | "commit_edge_history" | "directory" | "active_version" | "state_with_tombstones" | "directory_by_version" | "directory_history" |
| Parameter | Type | Description |
|---|---|---|
entityType? | TB | The type of entity table being queried (e.g., "file", "account", "conversation"). Optional when the context is unambiguous (e.g., single table queries with no joins). |
equals(
entity:LixEntityCanonical|LixEntity): (eb:ExpressionBuilder<LixDatabaseSchema,TB>) =>ExpressionWrapper<LixDatabaseSchema,TB,SqlBool>
Creates a filter that matches entities equal to the specified entity.
await lix.db.selectFrom("account")
.where(ebEntity("account").equals(targetAccount))
.selectAll()
.execute();| Parameter | Type | Description |
|---|---|---|
entity | LixEntityCanonical | LixEntity | The entity to match against (must have entity_id, schema_key, file_id) |
Expression wrapper for use in WHERE clauses
(
eb:ExpressionBuilder<LixDatabaseSchema,TB>):ExpressionWrapper<LixDatabaseSchema,TB,SqlBool>
| Parameter | Type |
|---|---|
eb | ExpressionBuilder<LixDatabaseSchema, TB> |
ExpressionWrapper<LixDatabaseSchema, TB, SqlBool>
hasLabel(
label: {id:string;name?:string; } | {id?:string;name:string; }): (eb:ExpressionBuilder<LixDatabaseSchema,TB>) =>ExpressionWrapper<LixDatabaseSchema,TB,SqlBool>
Creates a filter that matches entities having the specified label.
await lix.db.selectFrom("file")
.where(ebEntity("file").hasLabel({ name: "important" }))
.selectAll()
.execute();| Parameter | Type | Description |
|---|---|---|
label | { id: string; name?: string; } | { id?: string; name: string; } | The label to filter by (either { name: "..." } or { id: "..." }) |
Expression wrapper for use in WHERE clauses
(
eb:ExpressionBuilder<LixDatabaseSchema,TB>):ExpressionWrapper<LixDatabaseSchema,TB,SqlBool>
| Parameter | Type |
|---|---|
eb | ExpressionBuilder<LixDatabaseSchema, TB> |
ExpressionWrapper<LixDatabaseSchema, TB, SqlBool>
in(
entities: ({entity_id:string;file_id:string;schema_key:string; } | {lixcol_entity_id:string;lixcol_file_id:string;lixcol_schema_key:string; })[]): (eb:ExpressionBuilder<LixDatabaseSchema,TB>) =>ExpressionWrapper<LixDatabaseSchema,TB,SqlBool>
Creates a filter that matches entities in the specified list.
await lix.db.selectFrom("conversation")
.where(ebEntity("conversation").in([c1, c2, c3]))
.selectAll()
.execute();| Parameter | Type | Description |
|---|---|---|
entities | ({ entity_id: string; file_id: string; schema_key: string; } | { lixcol_entity_id: string; lixcol_file_id: string; lixcol_schema_key: string; })[] | Array of entities to match against |
Expression wrapper for use in WHERE clauses
(
eb:ExpressionBuilder<LixDatabaseSchema,TB>):ExpressionWrapper<LixDatabaseSchema,TB,SqlBool>
| Parameter | Type |
|---|---|
eb | ExpressionBuilder<LixDatabaseSchema, TB> |
ExpressionWrapper<LixDatabaseSchema, TB, SqlBool>