models

package
v0.0.0-...-39e08ed Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseMessage

type BaseMessage struct {
	ID          string                 `json:"id"`
	MessageType string                 `json:"type"`
	From        string                 `json:"from,omitempty"`
	To          string                 `json:"to,omitempty"`
	Ok          bool                   `json:"ok"`
	Payload     map[string]interface{} `json:"payload"`
}

BaseMessage is a basic message model, basis of the whole protocol. It is used for a very easy protocol extension process.

func NewBaseMessage

func NewBaseMessage(id, messageType, from string, to string, ok bool, payload map[string]interface{}) BaseMessage

func NewEmptyBaseMessage

func NewEmptyBaseMessage() BaseMessage

type EntityID

type EntityID struct {
	Type           EntityIDType
	LocalPart      string
	ServerPart     string
	Attr           string
	OnlyServerPart bool
}

func NewEntityID

func NewEntityID(typ, localPart, serverPart string) (*EntityID, error)

func NewEntityIDFromString

func NewEntityIDFromString(entityID string) (*EntityID, error)

func NewEntityIDWithAttr

func NewEntityIDWithAttr(typ, attr, localPart, serverPart string) (*EntityID, error)

func (*EntityID) String

func (eID *EntityID) String() string

type EntityIDType

type EntityIDType string
const (
	UsernameType  EntityIDType = "@"
	ChatAliasType EntityIDType = "#"
	ChatIDType    EntityIDType = "!"
	ThirdPIDType  EntityIDType = "%"
	OtherType     EntityIDType = "&"
)

type ProtocolError

type ProtocolError struct {
	ErrCode    string                 `structs:"code"`
	ErrText    string                 `structs:"text,omitempty"`
	ErrPayload map[string]interface{} `structs:"payload,omitempty"`
}

type User

type User struct {
	ID           primitive.ObjectID `json:"-" bson:"_id"`
	UUID         string             `json:"uuid"`
	Username     string             `json:"username"`
	PasswordHash string             `json:"-" bson:"passwordHash"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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