types

package
v0.0.0-...-4997385 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2015 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserIdPrefix  = '@'
	RoomIdPrefix  = '!'
	EventIdPrefix = '$'
	AliasPrefix   = '#'
)

Variables

This section is empty.

Functions

func ParseStreamToken

func ParseStreamToken(str string) (StreamToken, Error)

Types

type Alias

type Alias Id

func DeriveAlias

func DeriveAlias(id string, from Id) Alias

func NewAlias

func NewAlias(id, domain string) Alias

func ParseAlias

func ParseAlias(str string) (id Alias, err error)

func (Alias) MarshalJSON

func (i Alias) MarshalJSON() ([]byte, error)

func (Alias) String

func (i Alias) String() string

func (*Alias) UnmarshalJSON

func (i *Alias) UnmarshalJSON(bytes []byte) (err error)

type Error

type Error interface {
	error
	Code() string
}

func InvalidStateError

func InvalidStateError(message string) Error

func ParseError

func ParseError(message string) Error

type EventId

type EventId Id

func DeriveEventId

func DeriveEventId(id string, from Id) EventId

func NewEventId

func NewEventId(id, domain string) EventId

func ParseEventId

func ParseEventId(str string) (id EventId, err error)

func (EventId) MarshalJSON

func (i EventId) MarshalJSON() ([]byte, error)

func (EventId) String

func (i EventId) String() string

func (*EventId) UnmarshalJSON

func (i *EventId) UnmarshalJSON(bytes []byte) (err error)

type EventInfo

type EventInfo struct {
	ContextId Id
	EventId   Id
	Sender    Id
	EventType string
}

func NewEventInfo

func NewEventInfo(contextId, eventId, sender Id, eventType string) EventInfo

type Id

type Id struct {
	Prefix rune
	Id     string
	// contains filtered or unexported fields
}

func DeriveId

func DeriveId(id string, from Id) Id

func (Id) Domain

func (id Id) Domain() string

func (Id) String

func (id Id) String() string

func (Id) Valid

func (id Id) Valid() bool

type IdParseError

type IdParseError string

func (IdParseError) Error

func (e IdParseError) Error() string

type Ids

type Ids []Id

func IdsFromAliases

func IdsFromAliases(ids []Alias) Ids

func IdsFromEventIds

func IdsFromEventIds(ids []EventId) Ids

func IdsFromRoomIds

func IdsFromRoomIds(ids []RoomId) Ids

func IdsFromUserIds

func IdsFromUserIds(ids []UserId) Ids

type IndexedEventInfo

type IndexedEventInfo struct {
	EventInfo
	Index uint64
}

func NewIndexedEventInfo

func NewIndexedEventInfo(eventInfo EventInfo, index uint64) IndexedEventInfo

type RoomId

type RoomId Id

func DeriveRoomId

func DeriveRoomId(id string, from Id) RoomId

func NewRoomId

func NewRoomId(id, domain string) RoomId

func ParseRoomId

func ParseRoomId(str string) (id RoomId, err error)

func (RoomId) MarshalJSON

func (i RoomId) MarshalJSON() ([]byte, error)

func (RoomId) String

func (i RoomId) String() string

func (*RoomId) UnmarshalJSON

func (i *RoomId) UnmarshalJSON(bytes []byte) (err error)

type ShardId

type ShardId uint32

func (ShardId) Index

func (id ShardId) Index() int

func (ShardId) TotalCount

func (id ShardId) TotalCount() int

type ShardTuple

type ShardTuple struct {
	ShardId     ShardId
	EventIndex  uint64
	SignalIndex uint64
}

type StreamToken

type StreamToken []ShardTuple

type Timestamp

type Timestamp struct {
	time.Time
}

func (Timestamp) MarshalJSON

func (ts Timestamp) MarshalJSON() ([]byte, error)

type UserId

type UserId Id

func DeriveUserId

func DeriveUserId(id string, from Id) UserId

func NewUserId

func NewUserId(id, domain string) UserId

func ParseUserId

func ParseUserId(str string) (id UserId, err error)

func (UserId) MarshalJSON

func (i UserId) MarshalJSON() ([]byte, error)

func (UserId) String

func (i UserId) String() string

func (*UserId) UnmarshalJSON

func (i *UserId) UnmarshalJSON(bytes []byte) (err error)

Jump to

Keyboard shortcuts

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