-
Notifications
You must be signed in to change notification settings - Fork 0
/
keeper.go
30 lines (22 loc) · 914 Bytes
/
keeper.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright [2021] - [2022], AssetMantle Pte. Ltd. and the code contributors
// SPDX-License-Identifier: Apache-2.0
package asset
import (
sdkTypes "github.com/cosmos/cosmos-sdk/types"
"github.com/AssetMantle/modules/modules/assets/internal/key"
"github.com/AssetMantle/modules/schema/helpers"
)
type queryKeeper struct {
mapper helpers.Mapper
}
var _ helpers.QueryKeeper = (*queryKeeper)(nil)
func (queryKeeper queryKeeper) Enquire(context sdkTypes.Context, queryRequest helpers.QueryRequest) helpers.QueryResponse {
return newQueryResponse(queryKeeper.mapper.NewCollection(context).Fetch(key.NewKey(queryRequestFromInterface(queryRequest).AssetID)), nil)
}
func (queryKeeper queryKeeper) Initialize(mapper helpers.Mapper, _ helpers.Parameters, _ []interface{}) helpers.Keeper {
queryKeeper.mapper = mapper
return queryKeeper
}
func keeperPrototype() helpers.QueryKeeper {
return queryKeeper{}
}