# `Electric.Replication.Changes.TransactionFragment`
[🔗](https://github.com/electric-sql/electric/tree/%40core/sync-service%401.6.2/packages/sync-service/lib/electric/replication/changes.ex#L97)

Represents a transaction or part of a transaction from the replication stream.

The `has_begin?` and `commit` fields indicate which portion of a transaction
the fragment represents:

- Full transaction: `has_begin?` is true and `commit` is set
- Start of a transaction: `has_begin?` is true but no `commit`
- Middle of a transaction: `has_begin?` is false and no `commit`
- End of a transaction: `has_begin?` is false but `commit` is set

# `t`

```elixir
@type t() :: %Electric.Replication.Changes.TransactionFragment{
  affected_relations: MapSet.t(Electric.Replication.Changes.relation_name()),
  change_count: non_neg_integer(),
  changes: [Electric.Replication.Changes.change()],
  commit: Electric.Replication.Changes.Commit.t() | nil,
  has_begin?: boolean(),
  last_log_offset: Electric.Replication.LogOffset.t() | nil,
  lsn: Electric.Postgres.Lsn.t() | nil,
  xid: Electric.Replication.Changes.xid() | nil
}
```

# `complete_transaction?`
*macro* 

---

*Consult [api-reference.md](api-reference.md) for complete listing*
