model

package
v0.0.0-...-de8c022 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	ID        int
	Content   string
	Author    string
	AvatarUrl string
	Likes     int
	Duration  string
	IsMine    bool
	MyRate    int
	Replies   []*Reply
}

type CreateCommentInput

type CreateCommentInput struct {
	Author    *string
	Content   string
	ParentID  *int
	Addressee *string
}

type DBComment

type DBComment struct {
	ID        int
	Content   string
	Author    string
	AvatarUrl string
	Likes     int
	Duration  string
	IsMine    bool
	MyRate    int
	ParentID  *int
	Addressee *string
}

type DeleteCommentInput

type DeleteCommentInput struct {
	ID       *int
	Username *string
}

type Model

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

func New

func New(log *slog.Logger, conf *configs.DBConfig) (*Model, error)

func (*Model) CreateComment

func (m *Model) CreateComment(ctx context.Context, input *CreateCommentInput) error

func (*Model) DeleteComment

func (m *Model) DeleteComment(ctx context.Context, input *DeleteCommentInput) error

func (*Model) ReadComments

func (m *Model) ReadComments(ctx context.Context, username string) ([]*Comment, error)

func (*Model) UpdateComment

func (m *Model) UpdateComment(ctx context.Context, input *UpdateCommentInput) error

func (*Model) UpsertLike

func (m *Model) UpsertLike(ctx context.Context, input *UpsertLikeInput) error

type Reply

type Reply struct {
	ID        int
	Content   string
	Author    string
	AvatarUrl string
	Likes     int
	Duration  string
	IsMine    bool
	MyRate    int
	Addressee string
}

type UpdateCommentInput

type UpdateCommentInput struct {
	ID      *int
	Author  *string
	Content string
}

type UpsertLikeInput

type UpsertLikeInput struct {
	Author    *string
	CommentID *int
	Rate      *int
}

Jump to

Keyboard shortcuts

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