room

package
v0.0.0-...-10f3eee Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	ID        string `json:"id"`
	Status    Status `json:"status"`
	PlayerID  string `json:"player_id"`
	MonsterID string `json:"monster_id"`
}

func EntityToData

func EntityToData(input *entities.Room) *Data

type ListByPlayerInput

type ListByPlayerInput struct {
	PlayerID string
	Limit    int64
	Offset   int64
	Reverse  bool
}

type Mock

type Mock struct {
	mock.Mock
}

func (*Mock) Create

func (m *Mock) Create(ctx context.Context, room *Data) (*Data, error)

func (*Mock) Get

func (m *Mock) Get(ctx context.Context, id string) (*Data, error)

func (*Mock) ListByPlayer

func (m *Mock) ListByPlayer(ctx context.Context, input *ListByPlayerInput) ([]*Data, error)

func (*Mock) Update

func (m *Mock) Update(ctx context.Context, room *Data) (*Data, error)

type Redis

type Redis struct {
	// contains filtered or unexported fields
}

func NewRedis

func NewRedis(cfg *RedisConfig) (*Redis, error)

func (*Redis) Create

func (r *Redis) Create(ctx context.Context, room *Data) (*Data, error)

Create creates a room and assigns it to the owners index

func (*Redis) Get

func (r *Redis) Get(ctx context.Context, id string) (*Data, error)

func (*Redis) ListByPlayer

func (r *Redis) ListByPlayer(ctx context.Context, input *ListByPlayerInput) ([]*Data, error)

func (*Redis) Update

func (r *Redis) Update(ctx context.Context, room *Data) (*Data, error)

type RedisConfig

type RedisConfig struct {
	Client redis.UniversalClient
}

type Repository

type Repository interface {
	Create(ctx context.Context, room *Data) (*Data, error)
	Update(ctx context.Context, room *Data) (*Data, error)
	Get(ctx context.Context, id string) (*Data, error)
	ListByPlayer(ctx context.Context, input *ListByPlayerInput) ([]*Data, error)
}

type Status

type Status string
const (
	StatusUnset    Status = ""
	StatusActive   Status = "active"
	StatusInactive Status = "inactive"
)

func EntityToRoomStatus

func EntityToRoomStatus(input entities.RoomStatus) Status

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL