agent

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: CC0-1.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CandidToEvent

func CandidToEvent(e *Event) *event.T

Types

type Backend

type Backend struct {
	*agent_go.Agent
	CanisterID principal.Principal
}

func New

func New(cid, canAddr string) (a *Backend, err error)

func (*Backend) GetCandidEvent

func (a *Backend) GetCandidEvent(filter *Filter) ([]Event, error)

func (*Backend) QueryEvents

func (a *Backend) QueryEvents(c context.T, ch chan *event.T, f *filter.T) (err error)

func (*Backend) SaveCandidEvent

func (a *Backend) SaveCandidEvent(event Event) (result string, err error)

func (*Backend) SaveEvent

func (a *Backend) SaveEvent(c context.T, e *event.T) (err error)

type Event

type Event struct {
	ID        string     `ic:"id"`
	Pubkey    string     `ic:"pubkey"`
	CreatedAt int64      `ic:"created_at"`
	Kind      uint16     `ic:"kind"`
	Tags      [][]string `ic:"tags"`
	Content   string     `ic:"content"`
	Sig       string     `ic:"sig"`
}

func EventToCandid

func EventToCandid(e *event.T) Event

type Filter

type Filter struct {
	IDs     []string       `ic:"ids"`
	Kinds   []uint16       `ic:"kinds"`
	Authors []string       `ic:"authors"`
	Tags    []KeyValuePair `ic:"tags"`
	Since   int64          `ic:"since"`
	Until   int64          `ic:"until"`
	Limit   int64          `ic:"limit"`
	Search  string         `ic:"search"`
}

func FilterToCandid

func FilterToCandid(f *filter.T) (result *Filter)

type KeyValuePair

type KeyValuePair struct {
	Key   string   `ic:"key"`
	Value []string `ic:"value"`
}

func TagMapToKV

func TagMapToKV(t filter.TagMap) (keys []KeyValuePair)

Jump to

Keyboard shortcuts

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