escargo

package module
v0.0.0-...-fe85582 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2022 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

escargot

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSendMessage           = errors.New("failed to send message")
	ErrGetMessage            = errors.New("failed to get message")
	ErrDeleteMessage         = errors.New("failed to delete message")
	ErrJSONEncode            = errors.New("failed to encode json")
	ErrRollback              = errors.New("failed rollback")
	ErrCommit                = errors.New("failed commit")
	ErrOptimisticConcurrency = errors.New("different version")
	ErrNotFoundEntity        = errors.New("entity not found")
)

Functions

This section is empty.

Types

type Connection

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

func New

func New(s *discordgo.Session) *Connection

func (*Connection) Save

func (c *Connection) Save(
	entityCh, eventCh, snapshotCh string,
	entityID string,
	snapshotOpt OptionalSnapshot,
	events ...Event,
) error

func (*Connection) Update

func (c *Connection) Update(
	entityCh, eventCh, snapshotCh string,
	entityID string,
	version uint64,
	snapshotOpt OptionalSnapshot,
	events ...Event,
) error

type EntitySchema

type EntitySchema struct {
	Version uint64     `json:"version"`
	ID      string     `json:"id"`
	Last    MessageKey `json:"last"`
}

type Event

type Event struct {
	Name    string
	Payload map[string]interface{}
}

type EventSchema

type EventSchema struct {
	Version  uint64                 `json:"version"`
	Name     string                 `json:"name"`
	EntityID string                 `json:"entityID"`
	Payload  map[string]interface{} `json:"payload"`
}

type MessageKey

type MessageKey struct {
	Channel string `json:"channel"`
	Message string `json:"message"`
}

type OptionalEntityMessage

type OptionalEntityMessage struct {
	Ok         bool
	Schema     EntitySchema
	MessageKey MessageKey
}

type OptionalSnapshot

type OptionalSnapshot struct {
	Ok   bool
	Data map[string]interface{}
}

type OptionalSnapshotMessage

type OptionalSnapshotMessage struct {
	Ok         bool
	Schema     SnapshotSchema
	MessageKey MessageKey
}

type SnapshotSchema

type SnapshotSchema struct {
	Version  uint64                 `json:"version"`
	EntityID string                 `json:"entityID"`
	Last     MessageKey             `json:"last"`
	Data     map[string]interface{} `json:"data"`
}

Jump to

Keyboard shortcuts

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