domain

package
v0.0.0-...-3e81ccd Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContext

func NewContext(next echo.HandlerFunc) echo.HandlerFunc

Types

type Context

type Context struct {
	echo.Context
	PubKey    *UserPubKey
	SecretKey *UserSecretKey
}

type PagingOptions

type PagingOptions struct {
	MaxResults int
	SinceTime  *time.Time
	UntilTime  *time.Time
}

type Post

type Post struct {
	ID         PostID
	UserPubKey UserPubKey
	Content    string
	CreatedAt  time.Time

	RootPostID           *PostID
	ReplyPostID          *PostID
	MentionedUserPubKeys []UserPubKey
}

type PostID

type PostID string

type PostRepository

type PostRepository interface {

	// SendPost
	SendPost(UserPubKey, UserSecretKey, string) error

	// GetPost
	GetPost(id PostID) (*Post, error)

	// GetPosts
	GetPosts(
		pks []UserPubKey,
		options PagingOptions,
	) ([]Post, error)

	// GetPublicPosts
	GetPublicPosts(
		options PagingOptions,
	) ([]Post, error)

	// GetUserLatestPosts
	GetUserLatestPosts(
		pk UserPubKey,
	) ([]Post, error)

	// GetReplies
	GetReplies(PostID) ([]Post, error)
}

type PostWithUser

type PostWithUser struct {
	Post
	User
}

type Reaction

type Reaction struct {
	ID         ReactionID
	UserPubKey UserPubKey
	Content    string
	CreatedAt  time.Time

	ToPostID     PostID
	ToUserPubKey UserPubKey
}

type ReactionID

type ReactionID string

type ReactionRepository

type ReactionRepository interface {

	// GetReactions
	GetReactions(PostID) ([]Reaction, error)
}

type RelationShipRepository

type RelationShipRepository interface {

	// GetFollowings
	GetFollowings(UserPubKey) ([]UserPubKey, error)

	// GetFollowers
	GetFollowers(UserPubKey) ([]UserPubKey, error)
}

type Repost

type Repost struct {
	ID         RepostID
	UserPubKey UserPubKey
	Content    string
	CreatedAt  time.Time

	ToPostID     PostID
	ToUserPubKey UserPubKey
}

type RepostID

type RepostID string

type RepostRepository

type RepostRepository interface {

	// GetReposts
	GetReposts(PostID) ([]Repost, error)
}

type Timeline

type Timeline struct {
	Post   *Post
	Repost *Repost
}

type TimelineRepository

type TimelineRepository interface {

	// GetTimelines
	GetTimelines(
		pks []UserPubKey,
		options PagingOptions,
	) ([]Timeline, error)
}

type User

type User struct {
	PubKey      UserPubKey
	Name        string
	DisplayName string
	About       string
	Picture     string
	Banner      string
	Website     string
	Lud06       string
	CreatedAt   int64
}

type UserPubKey

type UserPubKey string

UserPubKey User's public key

func ToUserPubKey

func ToUserPubKey(uid string) (*UserPubKey, error)

type UserRepository

type UserRepository interface {

	// GetUsers
	GetUsers([]UserPubKey) ([]User, error)
}

type UserSecretKey

type UserSecretKey string

UserSecretKey User's secret key

Jump to

Keyboard shortcuts

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