commands

package
v0.0.0-...-6b5a9da Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUserSignInUserNotFound = NewCommandValidationError("user not found")
View Source
var ErrUserSignUpCommandUsernameAlreadyTaken = NewCommandValidationError("username is already taken")
View Source
var ErrUserSignUpCommandUsernameTooLong = NewCommandValidationError("username is too long")
View Source
var ErrUserSignUpCommandUsernameTooShort = NewCommandValidationError("username is too short")
View Source
var ErrUserSubmitCommentNotAuthorized = NewCommandValidationError("user is not authorized to comment")
View Source
var ErrUserSubmitCommentPostOrCommentMustBeProvided = NewCommandValidationError("post or comment must be provided")
View Source
var ErrVoteCommentCommandInvalidVoteValue = NewCommandValidationError("invalid vote value")
View Source
var ErrVoteCommentCommandUserNotAllowed = NewCommandValidationError("user is not allowed to vote")
View Source
var ErrVotePostCommandInvalidVoteValue = NewCommandValidationError("invalid vote value")
View Source
var ErrVotePostCommandUserNotAllowed = NewCommandValidationError("user is not allowed to vote")
View Source
var SystemIncrementPostVoteCountsAggregateInvalidTimestampErr = NewCommandValidationError("invalid timestamp")

Functions

func NewCommandValidationError

func NewCommandValidationError(msg string) error

Types

type CommandValidationError

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

func (*CommandValidationError) Error

func (e *CommandValidationError) Error() string

type Commands

type Commands struct {
	Events *events.Events
	// contains filtered or unexported fields
}

func New

func New(queries *state.Queries, events *events.Events) *Commands

func (*Commands) SystemIncrementPostVoteCountsAggregate

func (c *Commands) SystemIncrementPostVoteCountsAggregate(
	ctx context.Context, timestamp time.Time, vote_value state.VoteValue) error

func (*Commands) UserAddCommentToPost

func (c *Commands) UserAddCommentToPost(ctx context.Context, user *state.User,
	post *state.Post, content string) (state.Comment, error)

func (*Commands) UserSignIn

func (c *Commands) UserSignIn(ctx context.Context, username string) (state.User, bool, error)

func (*Commands) UserSignUp

func (c *Commands) UserSignUp(ctx context.Context, username string) (state.User, error)

func (*Commands) UserSubmitCommentForComment

func (c *Commands) UserSubmitCommentForComment(ctx context.Context, user *state.User,
	parent_comment *state.Comment, content string) (state.Comment, error)

func (*Commands) UserVoteComment

func (c *Commands) UserVoteComment(ctx context.Context, user *state.User, comment_id int64, value state.VoteValue) (state.CommentVote, error)

func (*Commands) UserVotePost

func (c *Commands) UserVotePost(ctx context.Context, user *state.User, post_id int64, vote_value state.VoteValue) (state.PostVote, error)

Jump to

Keyboard shortcuts

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