kind

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2024 License: CC0-1.0, MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Array added in v1.0.6

type Array []T

func (Array) Clone added in v1.0.6

func (ar Array) Clone() (c Array)

Clone makes a new kind.Array with the same members.

func (Array) Contains added in v1.0.6

func (ar Array) Contains(s T) bool

Contains returns true if the provided element is found in the kind.Array.

Note that the request must use the typed kind.T or convert the number thus. Even if a custom number is found, this codebase does not have the logic to deal with the kind so such a search is pointless and for which reason static typing always wins. No mistakes possible with known quantities.

func (Array) Equals added in v1.0.6

func (ar Array) Equals(t1 Array) bool

Equals checks that the provided kind.Array matches.

func (Array) ToArray added in v1.0.6

func (ar Array) ToArray() (a array.T)

ToArray converts to the generic array.T type ([]interface{})

type T

type T uint16

T - which will be externally referenced as kind.T is the event type in the nostr protocol, the use of the capital T signifying type, consistent with Go idiom, the Go standard library, and much, conformant, existing code.

const (
	ProfileMetadata               T = 0
	SetMetadata                   T = 0
	TextNote                      T = 1
	RecommendServer               T = 2
	ContactList                   T = 3
	EncryptedDirectMessage        T = 4
	Deletion                      T = 5
	Repost                        T = 6
	Reaction                      T = 7
	ChannelCreation               T = 40
	ChannelMetadata               T = 41
	ChannelMessage                T = 42
	ChannelHideMessage            T = 43
	ChannelMuteUser               T = 44
	FileMetadata                  T = 1063
	MemoryHole                    T = 1984
	ZapRequest                    T = 9734
	Zap                           T = 9735
	ReplaceableStart              T = 10000
	MuteList                      T = 10000
	PinList                       T = 10001
	RelayListMetadata             T = 10002
	NWCWalletInfo                 T = 13194
	ReplaceableEnd                T = 20000
	EphemeralStart                T = 20000
	ClientAuthentication          T = 22242
	NWCWalletRequest              T = 23194
	NWCWalletResponse             T = 23195
	NostrConnect                  T = 24133
	EphemeralEnd                  T = 30000
	ParameterizedReplaceableStart T = 30000
	CategorizedPeopleList         T = 30000
	CategorizedBookmarksList      T = 30001
	ProfileBadges                 T = 30008
	BadgeDefinition               T = 30009
	StallDefinition               T = 30017
	ProductDefinition             T = 30018
	Article                       T = 30023
	ApplicationSpecificData       T = 30078
	ParameterizedReplaceableEnd   T = 40000
)

The event kinds are put in a separate package so they will be referred to as `kind.EventType` rather than `nostr.KindEventType` as this is correct Go idiom and the version in https://github.com/nbd-wtf/go-nostr is unclear and excessive in length, impeding readability. Repeating 'nostr' in these constant names is redundant as they are only used in this context, and creating a special type for them makes this implicit and enforced by the compiler at compile time.

func (T) IsEphemeral

func (evt T) IsEphemeral() bool

func (T) IsParameterizedReplaceable

func (evt T) IsParameterizedReplaceable() bool

func (T) IsReplaceable

func (evt T) IsReplaceable() bool

Jump to

Keyboard shortcuts

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