topic

package
v0.0.0-...-61222a5 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Forum

type Forum struct {
	ID   uuid.UUID
	Name string
	Slug string
}

Forum is the forum representation of this topics parent forum This avoids import cycle issues, plus we don't really need everything from forum.Forum anyway

type Repository

type Repository interface {
	FindByForum(ctx context.Context, id uuid.UUID) ([]Topic, error)
	FindBySlug(ctx context.Context, slug string) (*Topic, error)
}

type Service

type Service interface {
	GetForumTopics(ctx context.Context, id uuid.UUID) ([]Topic, error)
	GetBySlug(ctx context.Context, slug string) (*Topic, error)
}

func ProvideService

func ProvideService(repository Repository) Service

type Topic

type Topic struct {
	ID           uuid.UUID `bun:"type:uuid,default:uuid_generate_v4()"`
	ForumID      uuid.UUID `bun:"type:uuid"`
	Forum        Forum     `bun:"rel:belongs-to,join:forum_id=id"`
	Name         string
	AuthorID     uuid.UUID `bun:"type:uuid"`
	Author       user.User `bun:"rel:belongs-to,join:author_id=id"`
	LastPosterID uuid.UUID `bun:"type:uuid,default:uuid_nil()"`
	LastPoster   user.User `bun:"rel:belongs-to,join:last_poster_id=id"`
	Posts        int
	Views        int
	Slug         string
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

Jump to

Keyboard shortcuts

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