Commit a9b82285 authored by Andrei Mihu's avatar Andrei Mihu
Browse files

Make Go runtime match list min/max size optional.

parent fbe9d808
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr
- Runtime create tournament calls always return any existing tournament after repeated calls with the same ID.
- Upgrade to Go 1.13.4 and Debian buster-slim for base docker images.
- Limit maximum number of concurrent leaderboard/tournament callback executions.
- Allow Go runtime match listing operations min/max count to be optional.

### Fixed
- Correctly handle errors when concurrently writing new storage objects.
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ require (
	github.com/gorilla/mux v1.7.3
	github.com/gorilla/websocket v1.4.1
	github.com/grpc-ecosystem/grpc-gateway v1.11.1
	github.com/heroiclabs/nakama-common v1.1.1
	github.com/heroiclabs/nakama-common v1.2.0
	github.com/jackc/fake v0.0.0-20150926172116-812a484cc733 // indirect
	github.com/jackc/pgx v3.5.0+incompatible
	github.com/jmhodges/levigo v1.0.0 // indirect
+2 −0
+9 −3
Original line number Diff line number Diff line
@@ -845,7 +845,7 @@ func (n *RuntimeGoNakamaModule) MatchCreate(ctx context.Context, module string,
	return n.matchRegistry.CreateMatch(ctx, n.logger, fn, module, params)
}

func (n *RuntimeGoNakamaModule) MatchList(ctx context.Context, limit int, authoritative bool, label string, minSize, maxSize int, query string) ([]*api.Match, error) {
func (n *RuntimeGoNakamaModule) MatchList(ctx context.Context, limit int, authoritative bool, label string, minSize, maxSize *int, query string) ([]*api.Match, error) {
	authoritativeWrapper := &wrappers.BoolValue{Value: authoritative}
	var labelWrapper *wrappers.StringValue
	if label != "" {
@@ -855,8 +855,14 @@ func (n *RuntimeGoNakamaModule) MatchList(ctx context.Context, limit int, author
	if query != "" {
		queryWrapper = &wrappers.StringValue{Value: query}
	}
	minSizeWrapper := &wrappers.Int32Value{Value: int32(minSize)}
	maxSizeWrapper := &wrappers.Int32Value{Value: int32(maxSize)}
	var minSizeWrapper *wrappers.Int32Value
	if minSize != nil {
		minSizeWrapper = &wrappers.Int32Value{Value: int32(*minSize)}
	}
	var maxSizeWrapper *wrappers.Int32Value
	if maxSize != nil {
		maxSizeWrapper = &wrappers.Int32Value{Value: int32(*maxSize)}
	}

	return n.matchRegistry.ListMatches(ctx, limit, authoritativeWrapper, labelWrapper, minSizeWrapper, maxSizeWrapper, queryWrapper)
}
+1 −1
Original line number Diff line number Diff line
@@ -799,7 +799,7 @@ type NakamaModule interface {
	SessionDisconnect(ctx context.Context, sessionID, node string) error

	MatchCreate(ctx context.Context, module string, params map[string]interface{}) (string, error)
	MatchList(ctx context.Context, limit int, authoritative bool, label string, minSize, maxSize int, query string) ([]*api.Match, error)
	MatchList(ctx context.Context, limit int, authoritative bool, label string, minSize, maxSize *int, query string) ([]*api.Match, error)

	NotificationSend(ctx context.Context, userID, subject string, content map[string]interface{}, code int, sender string, persistent bool) error
	NotificationsSend(ctx context.Context, notifications []*NotificationSend) error
Loading