domain

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPostNotFound = errors.New("post not found")
)

Functions

This section is empty.

Types

type Post

type Post struct {
	PublishedAt time.Time
	CreatedAt   time.Time
	UpdatedAt   time.Time
	PublicID    string
	Title       string
	Author      string
	Slug        string
	Status      Status
	Description string
	Content     string
	ID          int32
}

func (Post) Compare added in v1.3.0

func (p Post) Compare(p2 Post) bool

type PostCreate

type PostCreate struct {
	PublicID    string
	Title       string
	Author      string
	Slug        string
	Description string
	Content     string
}

type PostRepository

type PostRepository interface {
	GetPost(ctx context.Context, id string) (*Post, error)
	GetPosts(ctx context.Context) ([]*Post, error)
	// GetPostBySlug(ctx context.Context, slug string) (*Post, error)
	CreatePost(ctx context.Context, post *PostCreate) (*Post, error)
	UpdatePost(ctx context.Context, post *Post) (*Post, error)
}

type PostUpdate

type PostUpdate struct {
	Title       string
	Author      string
	Slug        string
	Description string
	Content     string
	Status      Status
}

type PostUsecase

type PostUsecase interface {
	Get(ctx context.Context, id string) (*Post, error)
	GetPosts(ctx context.Context) ([]*Post, error)
	Create(ctx context.Context, title, author, slug, description, content string) (*Post, error)
	Update(ctx context.Context, id string, title, author, slug, description, content *string, status *Status) (*Post, error)
}

type Status

type Status string
const (
	Draft     Status = "draft"
	Published Status = "published"
	Archived  Status = "archived"
)

Jump to

Keyboard shortcuts

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