hey

package module
v0.0.0-...-8fb3740 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2016 License: MIT Imports: 3 Imported by: 0

README

hey

Build Status License Coverage Status

see data structure

see example of usage

change log

  • added ability to specify the name of the thread
  • added ability to search the events by the thread names (see example)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel interface {
	ClientID() uuid.UUID
	ChannelID() uuid.UUID
	Owners() []uuid.UUID
	RootThreadID() uuid.UUID
	CreatedAt() time.Time
	UpdatedAt() time.Time
}

type Event

type Event interface {
	EventID() uuid.UUID
	ChannelID() uuid.UUID
	ThreadID() uuid.UUID
	CreatorID() uuid.UUID

	Data() []byte

	ParentThreadID() uuid.UUID
	ParentEventID() uuid.UUID
	BranchThreadID() uuid.UUID

	CreatedAt() time.Time
	UpdatedAt() time.Time
}

type Hey

type Hey interface {
	// CreateChannel create new channel with root thread
	CreateChannel(
		ctx context.Context,
		userIDs []uuid.UUID,
	) (uuid.UUID, uuid.UUID, error)

	CreateChannelName(
		ctx context.Context,
		name string,
		userIDs []uuid.UUID,
	) (channelID uuid.UUID, rootThreadID uuid.UUID, err error)

	// CreateNodalEvent create new nodal event
	// waiting ChannelID from context
	CreateNodalEvent(
		ctx context.Context,
		threadID uuid.UUID,
		owners []uuid.UUID,
		creatorID uuid.UUID,
	) (newThreadID uuid.UUID, newEventID uuid.UUID, err error)

	CreateNodalEventWithData(
		ctx context.Context,
		threadID uuid.UUID,
		owners []uuid.UUID,
		creatorID uuid.UUID,
		data []byte,
	) (uuid.UUID, uuid.UUID, error)

	CreateNodalEventWithThreadName(
		ctx context.Context,
		threadName string,
		threadID uuid.UUID,
		owners []uuid.UUID,
		creatorID uuid.UUID,
	) (uuid.UUID, uuid.UUID, error)

	CreateNodalEventWithThreadNameWithData(
		ctx context.Context,
		threadName string,
		threadID uuid.UUID,
		owners []uuid.UUID,
		creatorID uuid.UUID,
		data []byte,
	) (uuid.UUID, uuid.UUID, error)

	// CreateNewBranchEvent create a new event in branch
	// if the event already has the branch - error
	CreateNewBranchEvent(
		ctx context.Context,
		threadID uuid.UUID,
		relatedEventID uuid.UUID,
		owners []uuid.UUID,
		creatorID uuid.UUID,
		data []byte,
	) (newThreadID uuid.UUID, newEventID uuid.UUID, err error)

	CreateNewBranchEventWithThreadName(
		ctx context.Context,
		threadName string,
		threadID uuid.UUID,
		relatedEventID uuid.UUID,
		owners []uuid.UUID,
		creatorID uuid.UUID,
		data []byte,
	) (uuid.UUID, uuid.UUID, error)

	// CreateEvent create event in existing thread
	CreateEvent(ctx context.Context,
		threadID uuid.UUID,
		creatorID uuid.UUID,
		data []byte,
	) (eventID uuid.UUID, err error)

	FindThreadByName(
		ctx context.Context,
		channelID uuid.UUID,
		name string,
	) (Thread, error)

	FindChannelByName(
		ctx context.Context,
		name string,
	) (Channel, error)

	// FindEvents find events
	// waiting WatcherID (from a user view) from context
	FindEvents(
		ctx context.Context,
		watcherID uuid.UUID,
		threadID uuid.UUID,
		cursorStr string,
		perPage int,
	) (SearchResult, error)

	FindEventsByName(
		ctx context.Context,
		watcherID uuid.UUID,
		specialName string,
		cursorStr string,
		perPage int,
	) (SearchResult, error)
}

Hey service

type SearchResult

type SearchResult interface {
	Events() []Event

	Cursor() string
	HasNext() bool
}

SearchResult search result events

type Thread

type Thread interface {
	ThreadID() uuid.UUID
	ChannelID() uuid.UUID
	Owners() []uuid.UUID
	ParentThreadID() uuid.UUID
	RelatedEventID() uuid.UUID
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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