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

# Attribute

This page lists the Go SDK names for [Attributes](https://docs.superdurable.io/zh-Hans/concepts/primitives/attribute.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 singleton Attribute                     | **DefineAttribute**, which returns an **Attribute**                                                                                          | [Attributes](https://docs.superdurable.io/zh-Hans/reference/server/runtime-data.md#attributes)                                     |
| Define an AttributeMap                           | **DefineAttributeMap**, which returns an **AttributeMap**                                                                                    | [Attributes](https://docs.superdurable.io/zh-Hans/reference/server/runtime-data.md#attributes)                                     |
| Declare it in the Flow                           | **Attributes** of **PersistenceSchema**, returned from **GetPersistenceSchema**                                                              | [Flow definition](https://docs.superdurable.io/zh-Hans/reference/go/flow.md#flow-definition)                                       |
| Read, write, and delete a value in a Step or RPC | **Get**, **Set**, and **Delete**                                                                                                             | [Commits](https://docs.superdurable.io/zh-Hans/reference/go/step.md#commit-boundary)                                               |
| Address one AttributeMap instance                | The instance argument of **AttributeMap.Get**, **AttributeMap.Set**, and **AttributeMap.Delete**                                             | [Attributes](https://docs.superdurable.io/zh-Hans/reference/server/runtime-data.md#attributes)                                     |
| Count AttributeMap instances and list their keys | **AttributeMap.MapSize** and **AttributeMap.AllInstanceKeys**                                                                                | [Selective state loading](https://docs.superdurable.io/zh-Hans/reference/go/step-options.md#selective-state-loading)               |
| Load AttributeMap values for a method            | **AttributeMap.Load**, 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)               |
| Lock a value for a read-modify-write             | **LockAttribute** and **LockAttributeMap**, with the lock fields of **StepOptions** or **LockAttributes** of **RPCOptions**                  | [Locks](https://docs.superdurable.io/zh-Hans/reference/server/runtime-data.md#attribute-locks)                                     |
| Index a value for search                         | **Indexed**, with **AttributeIndex** and **IndexType**                                                                                       | [Indexes](https://docs.superdurable.io/zh-Hans/reference/server/runtime-data.md#attribute-indexes)                                 |
| Project writes to an Attribute Store             | **SyncToAttributeStore**                                                                                                                     | [Attribute sync](https://docs.superdurable.io/zh-Hans/reference/server/attribute-store-sync.md)                                    |
| Store a value that can be erased                 | **HardDeleteOnNull**                                                                                                                         | [Hard-delete Attributes](https://docs.superdurable.io/zh-Hans/reference/server/runtime-data.md#hard-delete-attributes)             |
| Set a value when the Flow starts                 | **InitialAttribute** and **InitialAttributeMapValue** in **StartFlowOptions.Attributes**                                                     | [Attributes at start](https://docs.superdurable.io/zh-Hans/reference/go/start-flow-options.md#attributes)                          |
| Read values from outside the Flow                | **Client.GetAttributes**, with **ReadAttribute** and **ReadAttributeMapInstance**                                                            | [Read Attributes](https://docs.superdurable.io/zh-Hans/reference/server/runtime-client.md#read-attributes)                         |
| Wait until a value matches                       | **Client.WaitForAttributeMatch** and **Client.WaitForAttributeMapInstanceMatch**, with an **AttributeMatch** such as **AttributeMatchEqual** | [Wait for an Attribute match](https://docs.superdurable.io/zh-Hans/reference/server/runtime-client.md#wait-for-an-attribute-match) |

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

## Example

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