From b64fda28de77e9b979804ac1f1846fa46993d19f Mon Sep 17 00:00:00 2001 From: Simon Esposito Date: Thu, 13 Jul 2023 19:45:21 +0100 Subject: [PATCH] Add missing StorageIndexList Go runtime function. Vendor nakama-common. --- server/runtime_go_nakama.go | 18 ++++++++++++++++++ .../nakama-common/runtime/runtime.go | 1 + 2 files changed, 19 insertions(+) diff --git a/server/runtime_go_nakama.go b/server/runtime_go_nakama.go index 347dc7da8b..4aa724f52f 100644 --- a/server/runtime_go_nakama.go +++ b/server/runtime_go_nakama.go @@ -2045,6 +2045,24 @@ func (n *RuntimeGoNakamaModule) StorageDelete(ctx context.Context, deletes []*ru return err } +// @group storage +// @summary List storage index entries +// @param indexName(type=string) Name of the index to list entries from. +// @param queryString(type=string) Query to filter index entries. +// @param limit(type=int) Maximum number of results ro be returned. +// @return objects(*api..StorageObjectList) A list of storage objects. +// @return error(error) An optional error value if an error occurred. +func (n *RuntimeGoNakamaModule) StorageIndexList(ctx context.Context, indexName, query string, limit int) (*api.StorageObjects, error) { + if indexName == "" { + return nil, errors.New("expects a non-empty indexName") + } + if limit < 1 { + return nil, errors.New("limit must be > 0") + } + + return n.storageIndex.List(ctx, indexName, query, limit) +} + // @group users // @summary Update account, storage, and wallet information simultaneously. // @param ctx(type=context.Context) The context object represents information about the server and requester. diff --git a/vendor/github.com/heroiclabs/nakama-common/runtime/runtime.go b/vendor/github.com/heroiclabs/nakama-common/runtime/runtime.go index 8d99c4de4e..5894e2972c 100644 --- a/vendor/github.com/heroiclabs/nakama-common/runtime/runtime.go +++ b/vendor/github.com/heroiclabs/nakama-common/runtime/runtime.go @@ -1067,6 +1067,7 @@ type NakamaModule interface { StorageRead(ctx context.Context, reads []*StorageRead) ([]*api.StorageObject, error) StorageWrite(ctx context.Context, writes []*StorageWrite) ([]*api.StorageObjectAck, error) StorageDelete(ctx context.Context, deletes []*StorageDelete) error + StorageIndexList(ctx context.Context, indexName, query string, limit int) (*api.StorageObjects, error) MultiUpdate(ctx context.Context, accountUpdates []*AccountUpdate, storageWrites []*StorageWrite, walletUpdates []*WalletUpdate, updateLedger bool) ([]*api.StorageObjectAck, []*WalletUpdateResult, error)