data

package
v0.0.0-...-b345cb0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Player
}

type Commands

type Commands struct {
	Commands []Command `json:"list"`
}

func ToCommands

func ToCommands(commands ...Command) Commands

type GroupData

type GroupData struct {
	ID           int `json:"id"`
	TopicID      int `json:"topic_id"`
	MaxMessageID int `json:"last_message_id"`
}

type Message

type Message struct {
	ID int `json:"id"`

	Data      string    `json:"data"`
	Link      string    `json:"link"`
	Timestamp time.Time `json:"timestamp"`
	Hash      string    `json:"hash"`
	// contains filtered or unexported fields
}

func (*Message) CalculateHash

func (m *Message) CalculateHash()

func (*Message) SetAuthorID

func (m *Message) SetAuthorID(a int)

type Messages

type Messages struct {
	Messages []Message `json:"list"`
}

func ToMessages

func ToMessages(message ...Message) Messages

type Player

type Player struct {
	IP          string      `json:"ip,omitempty"`
	Data        string      `json:"data,omitempty"`
	Link        string      `json:"link,omitempty"`
	MMR         int         `json:"mmr,omitempty"`
	PossiblePos PossiblePos `json:"possible_pos,omitempty"`
	Timestamp   time.Time   `json:"timestamp,omitempty"`
}

type Players

type Players struct {
	Users []Player `json:"list"`
}

func ToPlayers

func ToPlayers(players ...Player) Players

type PossiblePos

type PossiblePos []int

type WsMessage

type WsMessage struct {
	Player
	// data.Command is same as Player
	// data.Message not aggregated to not ignore Link field by marshaller
	ID     int    `json:"id,omitempty"`
	Hash   string `json:"hash,omitempty"`
	Type   string `json:"msg_type,omitempty"` // Only ws thing {command|player|message}
	Action string `json:"action,omitempty"`   // Only ws thing {add|delete}
}

func FromCommand

func FromCommand(c Command) WsMessage

func FromMessage

func FromMessage(m Message) WsMessage

func FromPlayer

func FromPlayer(p Player) WsMessage

func (WsMessage) ToCommand

func (wm WsMessage) ToCommand() (c Command)

func (WsMessage) ToMessage

func (wm WsMessage) ToMessage() (m Message)

func (WsMessage) ToPlayer

func (wm WsMessage) ToPlayer() (p Player)

Jump to

Keyboard shortcuts

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