Skip to content

Commit

Permalink
docs: fix markdown code grammar (#22316)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaobei0715 authored Oct 21, 2024
1 parent 71ac584 commit 64e6d88
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions collections/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ You might need to implement them only if you're migrating to collections and the

Let's explore an example:

````go
```go
package collections

import (
Expand All @@ -186,7 +186,7 @@ func NewKeeper(storeKey *storetypes.KVStoreKey) Keeper {
IDs: collections.NewMap(sb, IDsPrefix, "ids", collections.StringKey, collections.Uint64Value),
}
}
````
```

We're now instantiating a map where the key is string and the value is `uint64`.
We already know the first three arguments of the ``NewMap`` function.
Expand Down Expand Up @@ -687,9 +687,9 @@ func NewKeeper(storeKey *storetypes.KVStoreKey) Keeper {

First of all we can see that in order to define a composite key of two elements we use the `collections.Pair` type:

````go
```go
collections.Map[collections.Pair[sdk.AccAddress, string], math.Int]
````
```

`collections.Pair` defines a key composed of two other keys, in our case the first part is `sdk.AccAddress`, the second
part is `string`.
Expand All @@ -706,7 +706,7 @@ encode the second part of the key.

Let's expand on the example we used before:

````go
```go
var BalancesPrefix = collections.NewPrefix(1)

type Keeper struct {
Expand Down Expand Up @@ -766,7 +766,7 @@ func (k Keeper) GetAllAddressBalancesBetween(ctx sdk.Context, address sdk.AccAdd
}
...
}
````
```

#### SetBalance

Expand Down

0 comments on commit 64e6d88

Please sign in to comment.