---
title: "Channel"
description: "This page lists the Go SDK names for Channels."
canonical_url: "https://docs.superdurable.io/zh-Hans/reference/go/channel/"
source: "docs/reference/go/channel.mdx"
locale: "zh-Hans"
---

# Channel

This page lists the Go SDK names for [Channels](https://docs.superdurable.io/zh-Hans/concepts/primitives/channel.md).
The doc comment of each API gives its parameters, defaults, and errors. Read
them in the [Go SDK API reference](https://docs.superdurable.io/zh-Hans/reference/go.md#api-reference).

<a id="api-names"></a>

## API names

| Task                                           | Go API                                                                                 | Dex behavior                                                                                                                     |
| ---------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| Define a Channel                               | **DefineChannel**, which returns a **Channel**                                         | [Channels](https://docs.superdurable.io/zh-Hans/reference/server/runtime-data.md#channels)                                       |
| Define a ChannelMap                            | **DefineChannelMap**, which returns a **ChannelMap**                                   | [ChannelMap](https://docs.superdurable.io/zh-Hans/reference/server/runtime-data.md#channelmap)                                   |
| Declare it in the Flow                         | **Channels** of **PersistenceSchema**, returned from **GetPersistenceSchema**          | [Flow definition](https://docs.superdurable.io/zh-Hans/reference/go/flow.md#flow-definition)                                     |
| Publish a message from a Step or RPC           | **Publish**                                                                            | [Commits](https://docs.superdurable.io/zh-Hans/reference/go/step.md#commit-boundary)                                             |
| Wait for messages                              | **ForOne**, **ForN**, **AtLeast**, **AtMost**, and **AtLeastAtMost**                   | [Wait conditions](https://docs.superdurable.io/zh-Hans/reference/server/runtime-data.md#channel-conditions)                      |
| Read the messages a wait consumed              | **GetConditionResults**                                                                | [Channel results](https://docs.superdurable.io/zh-Hans/reference/go/waits.md#channel-results)                                    |
| Load pending messages for a method             | **ChannelMap.LoadMessages**, with the load fields of **StepOptions** or **RPCOptions** | [Selective state loading](https://docs.superdurable.io/zh-Hans/reference/go/step-options.md#selective-state-loading)             |
| Read loaded pending messages                   | **PendingMessages** and **FindPendingMessage**                                         | [Pending messages](https://docs.superdurable.io/zh-Hans/reference/server/runtime-data.md#manage-pending-messages)                |
| Delete a pending message                       | **Delete**                                                                             | [Pending messages](https://docs.superdurable.io/zh-Hans/reference/server/runtime-data.md#manage-pending-messages)                |
| Read the number of pending messages            | **Size**                                                                               | [Selective state loading](https://docs.superdurable.io/zh-Hans/reference/go/step-options.md#selective-state-loading)             |
| Count ChannelMap instances and list their keys | **ChannelMap.MapSize** and **ChannelMap.AllInstanceKeys**                              | [ChannelMap](https://docs.superdurable.io/zh-Hans/reference/server/runtime-data.md#channelmap)                                   |
| Complete the Flow only when Channels are empty | **ForceCompleteIfChannelsEmpty**                                                       | [ForceCompleteIfChannelsEmpty](https://docs.superdurable.io/zh-Hans/reference/go/step-decisions.md#forcecompleteifchannelsempty) |

<a id="example"></a>

## Example

Example: [examples/go/primitives/channel/workflow.go](https://github.com/superdurable/dex/tree/main/examples/go/primitives/channel/workflow.go)
