post

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 Post

type Post struct {
	ID        uuid.UUID `bun:"type:uuid,default:uuid_generate_v4()"`
	TopicID   uuid.UUID `bun:"type:uuid"`
	Topic     Topic     `bun:"rel:belongs-to,join:topic_id=id"`
	Name      string
	Slug      string
	AuthorID  uuid.UUID `bun:"type:uuid"`
	Author    user.User `bun:"rel:belongs-to,join:author_id=id"`
	Content   string
	CreatedAt time.Time
	UpdatedAt time.Time
}

type Repository

type Repository interface {
	FindByTopic(ctx context.Context, id uuid.UUID) ([]Post, error)
}

type Service

type Service interface {
	GetTopicPosts(ctx context.Context, topicID uuid.UUID) ([]Post, error)
}

func ProvideService

func ProvideService(repository Repository) Service

type Topic

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

Topic is the topic representation of this posts topic This avoids import cycle issues, plus we don't really need everything from topic.Topic anyway

Jump to

Keyboard shortcuts

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