From 64e6d882c6a747ad142b81dd6ac16ce0b3f95dfa Mon Sep 17 00:00:00 2001 From: XiaoBei <1505929057@qq.com> Date: Mon, 21 Oct 2024 13:11:51 +0800 Subject: [PATCH] docs: fix markdown code grammar (#22316) --- collections/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/collections/README.md b/collections/README.md index 421bc255d1c..d6d73da218e 100644 --- a/collections/README.md +++ b/collections/README.md @@ -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 ( @@ -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. @@ -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`. @@ -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 { @@ -766,7 +766,7 @@ func (k Keeper) GetAllAddressBalancesBetween(ctx sdk.Context, address sdk.AccAdd } ... } -```` +``` #### SetBalance