> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Database

> Loyverse local sync: searchable entities, `.search()` filters, and operators.

The Loyverse plugin syncs data locally. Use `corsair.loyverse.db.<entity>.search({ data, limit?, offset? })` with the filters listed per entity.

<Info>
  **New to Corsair?** See [database operations](/concepts/database), [data synchronization](/concepts/integrations), and [multi-tenancy](/concepts/multi-tenancy).
</Info>

## Categories

Path: `loyverse.db.categories.search`

```ts theme={null}
const rows = await corsair.loyverse.db.categories.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field        | Type     | Operators                                  |
| ------------ | -------- | ------------------------------------------ |
| `entity_id`  | `string` | equals, contains, startsWith, endsWith, in |
| `id`         | `string` | equals, contains, startsWith, endsWith, in |
| `name`       | `string` | equals, contains, startsWith, endsWith, in |
| `color`      | `string` | equals, contains, startsWith, endsWith, in |
| `created_at` | `string` | equals, contains, startsWith, endsWith, in |
| `deleted_at` | `string` | equals, contains, startsWith, endsWith, in |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Customers

Path: `loyverse.db.customers.search`

```ts theme={null}
const rows = await corsair.loyverse.db.customers.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field                   | Type     | Operators                                  |
| ----------------------- | -------- | ------------------------------------------ |
| `entity_id`             | `string` | equals, contains, startsWith, endsWith, in |
| `id`                    | `string` | equals, contains, startsWith, endsWith, in |
| `name`                  | `string` | equals, contains, startsWith, endsWith, in |
| `email`                 | `string` | equals, contains, startsWith, endsWith, in |
| `phone_number`          | `string` | equals, contains, startsWith, endsWith, in |
| `address`               | `string` | equals, contains, startsWith, endsWith, in |
| `city`                  | `string` | equals, contains, startsWith, endsWith, in |
| `region`                | `string` | equals, contains, startsWith, endsWith, in |
| `postal_code`           | `string` | equals, contains, startsWith, endsWith, in |
| `country_code`          | `string` | equals, contains, startsWith, endsWith, in |
| `customer_code`         | `string` | equals, contains, startsWith, endsWith, in |
| `note`                  | `string` | equals, contains, startsWith, endsWith, in |
| `first_visit`           | `string` | equals, contains, startsWith, endsWith, in |
| `last_visit`            | `string` | equals, contains, startsWith, endsWith, in |
| `total_visits`          | `number` | equals, gt, gte, lt, lte, in               |
| `total_spent`           | `number` | equals, gt, gte, lt, lte, in               |
| `total_points`          | `number` | equals, gt, gte, lt, lte, in               |
| `permanent_deletion_at` | `string` | equals, contains, startsWith, endsWith, in |
| `created_at`            | `string` | equals, contains, startsWith, endsWith, in |
| `updated_at`            | `string` | equals, contains, startsWith, endsWith, in |
| `deleted_at`            | `string` | equals, contains, startsWith, endsWith, in |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Discounts

Path: `loyverse.db.discounts.search`

```ts theme={null}
const rows = await corsair.loyverse.db.discounts.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field               | Type      | Operators                                  |
| ------------------- | --------- | ------------------------------------------ |
| `entity_id`         | `string`  | equals, contains, startsWith, endsWith, in |
| `id`                | `string`  | equals, contains, startsWith, endsWith, in |
| `type`              | `string`  | equals, contains, startsWith, endsWith, in |
| `name`              | `string`  | equals, contains, startsWith, endsWith, in |
| `discount_amount`   | `number`  | equals, gt, gte, lt, lte, in               |
| `discount_percent`  | `number`  | equals, gt, gte, lt, lte, in               |
| `restricted_access` | `boolean` | equals                                     |
| `created_at`        | `string`  | equals, contains, startsWith, endsWith, in |
| `updated_at`        | `string`  | equals, contains, startsWith, endsWith, in |
| `deleted_at`        | `string`  | equals, contains, startsWith, endsWith, in |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Employees

Path: `loyverse.db.employees.search`

```ts theme={null}
const rows = await corsair.loyverse.db.employees.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field          | Type      | Operators                                  |
| -------------- | --------- | ------------------------------------------ |
| `entity_id`    | `string`  | equals, contains, startsWith, endsWith, in |
| `id`           | `string`  | equals, contains, startsWith, endsWith, in |
| `name`         | `string`  | equals, contains, startsWith, endsWith, in |
| `email`        | `string`  | equals, contains, startsWith, endsWith, in |
| `phone_number` | `string`  | equals, contains, startsWith, endsWith, in |
| `is_owner`     | `boolean` | equals                                     |
| `created_at`   | `string`  | equals, contains, startsWith, endsWith, in |
| `updated_at`   | `string`  | equals, contains, startsWith, endsWith, in |
| `deleted_at`   | `string`  | equals, contains, startsWith, endsWith, in |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Items

Path: `loyverse.db.items.search`

```ts theme={null}
const rows = await corsair.loyverse.db.items.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field                 | Type      | Operators                                  |
| --------------------- | --------- | ------------------------------------------ |
| `entity_id`           | `string`  | equals, contains, startsWith, endsWith, in |
| `id`                  | `string`  | equals, contains, startsWith, endsWith, in |
| `handle`              | `string`  | equals, contains, startsWith, endsWith, in |
| `item_name`           | `string`  | equals, contains, startsWith, endsWith, in |
| `description`         | `string`  | equals, contains, startsWith, endsWith, in |
| `reference_id`        | `string`  | equals, contains, startsWith, endsWith, in |
| `category_id`         | `string`  | equals, contains, startsWith, endsWith, in |
| `track_stock`         | `boolean` | equals                                     |
| `sold_by_weight`      | `boolean` | equals                                     |
| `is_composite`        | `boolean` | equals                                     |
| `use_production`      | `boolean` | equals                                     |
| `primary_supplier_id` | `string`  | equals, contains, startsWith, endsWith, in |
| `form`                | `string`  | equals, contains, startsWith, endsWith, in |
| `color`               | `string`  | equals, contains, startsWith, endsWith, in |
| `image_url`           | `string`  | equals, contains, startsWith, endsWith, in |
| `option1_name`        | `string`  | equals, contains, startsWith, endsWith, in |
| `option2_name`        | `string`  | equals, contains, startsWith, endsWith, in |
| `option3_name`        | `string`  | equals, contains, startsWith, endsWith, in |
| `created_at`          | `string`  | equals, contains, startsWith, endsWith, in |
| `updated_at`          | `string`  | equals, contains, startsWith, endsWith, in |
| `deleted_at`          | `string`  | equals, contains, startsWith, endsWith, in |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Merchant

Path: `loyverse.db.merchant.search`

```ts theme={null}
const rows = await corsair.loyverse.db.merchant.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field           | Type     | Operators                                  |
| --------------- | -------- | ------------------------------------------ |
| `entity_id`     | `string` | equals, contains, startsWith, endsWith, in |
| `id`            | `string` | equals, contains, startsWith, endsWith, in |
| `business_name` | `string` | equals, contains, startsWith, endsWith, in |
| `email`         | `string` | equals, contains, startsWith, endsWith, in |
| `country`       | `string` | equals, contains, startsWith, endsWith, in |
| `created_at`    | `string` | equals, contains, startsWith, endsWith, in |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Modifiers

Path: `loyverse.db.modifiers.search`

```ts theme={null}
const rows = await corsair.loyverse.db.modifiers.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field        | Type     | Operators                                  |
| ------------ | -------- | ------------------------------------------ |
| `entity_id`  | `string` | equals, contains, startsWith, endsWith, in |
| `id`         | `string` | equals, contains, startsWith, endsWith, in |
| `name`       | `string` | equals, contains, startsWith, endsWith, in |
| `position`   | `number` | equals, gt, gte, lt, lte, in               |
| `created_at` | `string` | equals, contains, startsWith, endsWith, in |
| `updated_at` | `string` | equals, contains, startsWith, endsWith, in |
| `deleted_at` | `string` | equals, contains, startsWith, endsWith, in |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Payment Types

Path: `loyverse.db.paymentTypes.search`

```ts theme={null}
const rows = await corsair.loyverse.db.paymentTypes.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field        | Type     | Operators                                  |
| ------------ | -------- | ------------------------------------------ |
| `entity_id`  | `string` | equals, contains, startsWith, endsWith, in |
| `id`         | `string` | equals, contains, startsWith, endsWith, in |
| `name`       | `string` | equals, contains, startsWith, endsWith, in |
| `type`       | `string` | equals, contains, startsWith, endsWith, in |
| `created_at` | `string` | equals, contains, startsWith, endsWith, in |
| `updated_at` | `string` | equals, contains, startsWith, endsWith, in |
| `deleted_at` | `string` | equals, contains, startsWith, endsWith, in |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Pos Devices

Path: `loyverse.db.posDevices.search`

```ts theme={null}
const rows = await corsair.loyverse.db.posDevices.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field        | Type      | Operators                                  |
| ------------ | --------- | ------------------------------------------ |
| `entity_id`  | `string`  | equals, contains, startsWith, endsWith, in |
| `id`         | `string`  | equals, contains, startsWith, endsWith, in |
| `name`       | `string`  | equals, contains, startsWith, endsWith, in |
| `store_id`   | `string`  | equals, contains, startsWith, endsWith, in |
| `activated`  | `boolean` | equals                                     |
| `deleted_at` | `string`  | equals, contains, startsWith, endsWith, in |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Stores

Path: `loyverse.db.stores.search`

```ts theme={null}
const rows = await corsair.loyverse.db.stores.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field          | Type     | Operators                                  |
| -------------- | -------- | ------------------------------------------ |
| `entity_id`    | `string` | equals, contains, startsWith, endsWith, in |
| `id`           | `string` | equals, contains, startsWith, endsWith, in |
| `name`         | `string` | equals, contains, startsWith, endsWith, in |
| `address`      | `string` | equals, contains, startsWith, endsWith, in |
| `city`         | `string` | equals, contains, startsWith, endsWith, in |
| `region`       | `string` | equals, contains, startsWith, endsWith, in |
| `state`        | `string` | equals, contains, startsWith, endsWith, in |
| `postal_code`  | `string` | equals, contains, startsWith, endsWith, in |
| `country_code` | `string` | equals, contains, startsWith, endsWith, in |
| `country`      | `string` | equals, contains, startsWith, endsWith, in |
| `phone_number` | `string` | equals, contains, startsWith, endsWith, in |
| `description`  | `string` | equals, contains, startsWith, endsWith, in |
| `created_at`   | `string` | equals, contains, startsWith, endsWith, in |
| `updated_at`   | `string` | equals, contains, startsWith, endsWith, in |
| `deleted_at`   | `string` | equals, contains, startsWith, endsWith, in |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Suppliers

Path: `loyverse.db.suppliers.search`

```ts theme={null}
const rows = await corsair.loyverse.db.suppliers.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field          | Type     | Operators                                  |
| -------------- | -------- | ------------------------------------------ |
| `entity_id`    | `string` | equals, contains, startsWith, endsWith, in |
| `id`           | `string` | equals, contains, startsWith, endsWith, in |
| `name`         | `string` | equals, contains, startsWith, endsWith, in |
| `contact`      | `string` | equals, contains, startsWith, endsWith, in |
| `email`        | `string` | equals, contains, startsWith, endsWith, in |
| `phone_number` | `string` | equals, contains, startsWith, endsWith, in |
| `address_1`    | `string` | equals, contains, startsWith, endsWith, in |
| `address_2`    | `string` | equals, contains, startsWith, endsWith, in |
| `city`         | `string` | equals, contains, startsWith, endsWith, in |
| `region`       | `string` | equals, contains, startsWith, endsWith, in |
| `postal_code`  | `string` | equals, contains, startsWith, endsWith, in |
| `country_code` | `string` | equals, contains, startsWith, endsWith, in |
| `website`      | `string` | equals, contains, startsWith, endsWith, in |
| `note`         | `string` | equals, contains, startsWith, endsWith, in |
| `created_at`   | `string` | equals, contains, startsWith, endsWith, in |
| `updated_at`   | `string` | equals, contains, startsWith, endsWith, in |
| `deleted_at`   | `string` | equals, contains, startsWith, endsWith, in |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Taxes

Path: `loyverse.db.taxes.search`

```ts theme={null}
const rows = await corsair.loyverse.db.taxes.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field        | Type     | Operators                                  |
| ------------ | -------- | ------------------------------------------ |
| `entity_id`  | `string` | equals, contains, startsWith, endsWith, in |
| `id`         | `string` | equals, contains, startsWith, endsWith, in |
| `name`       | `string` | equals, contains, startsWith, endsWith, in |
| `type`       | `string` | equals, contains, startsWith, endsWith, in |
| `rate`       | `number` | equals, gt, gte, lt, lte, in               |
| `created_at` | `string` | equals, contains, startsWith, endsWith, in |
| `updated_at` | `string` | equals, contains, startsWith, endsWith, in |
| `deleted_at` | `string` | equals, contains, startsWith, endsWith, in |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Variants

Path: `loyverse.db.variants.search`

```ts theme={null}
const rows = await corsair.loyverse.db.variants.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field                  | Type     | Operators                                  |
| ---------------------- | -------- | ------------------------------------------ |
| `entity_id`            | `string` | equals, contains, startsWith, endsWith, in |
| `variant_id`           | `string` | equals, contains, startsWith, endsWith, in |
| `item_id`              | `string` | equals, contains, startsWith, endsWith, in |
| `sku`                  | `string` | equals, contains, startsWith, endsWith, in |
| `reference_variant_id` | `string` | equals, contains, startsWith, endsWith, in |
| `option1_value`        | `string` | equals, contains, startsWith, endsWith, in |
| `option2_value`        | `string` | equals, contains, startsWith, endsWith, in |
| `option3_value`        | `string` | equals, contains, startsWith, endsWith, in |
| `barcode`              | `string` | equals, contains, startsWith, endsWith, in |
| `cost`                 | `number` | equals, gt, gte, lt, lte, in               |
| `purchase_cost`        | `number` | equals, gt, gte, lt, lte, in               |
| `default_pricing_type` | `string` | equals, contains, startsWith, endsWith, in |
| `default_price`        | `number` | equals, gt, gte, lt, lte, in               |
| `created_at`           | `string` | equals, contains, startsWith, endsWith, in |
| `updated_at`           | `string` | equals, contains, startsWith, endsWith, in |
| `deleted_at`           | `string` | equals, contains, startsWith, endsWith, in |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***
