playground

package
v1.16.5 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Author

type Author struct {
	ID        int
	FirstName string
	LastName  string
	Email     string
	Profile   UserProfile
}

func (Author) FullName

func (a Author) FullName() string

func (Author) IsAdmin

func (a Author) IsAdmin() bool

type Blog

type Blog struct {
	Posts      []Post
	Authors    map[int]Author
	TotalViews int
	TotalPosts int
	TotalLikes int
}

func ExampleData

func ExampleData() Blog

func (Blog) Add

func (Blog) Add(a, b float64) float64

func (Blog) HasTag

func (Blog) HasTag(post Post, tag string) bool

func (Blog) IsAdmin

func (Blog) IsAdmin(author Author) bool

func (Blog) IsZero

func (Blog) IsZero(post Post) bool

func (Blog) PopularPosts

func (b Blog) PopularPosts() []Post

func (Blog) RecentPosts

func (b Blog) RecentPosts() []Post

func (Blog) Sub

func (Blog) Sub(a, b float64) float64

func (Blog) Title

func (Blog) Title(post Post) string

func (Blog) TotalComments

func (b Blog) TotalComments() int

func (Blog) TotalUpvotes

func (b Blog) TotalUpvotes() int

func (Blog) WithID

func (Blog) WithID(posts []Post, id int) Post

type Comment

type Comment struct {
	ID          int
	AuthorName  string
	Content     string
	CommentDate time.Time
	Upvotes     int
}

func (Comment) AuthorEmail

func (c Comment) AuthorEmail() string

func (Comment) Upvoted

func (c Comment) Upvoted() bool

type Post

type Post struct {
	ID          int
	Title       string
	Content     string
	PublishDate time.Time
	Author      Author
	Comments    []Comment
	Tags        []string
	Likes       int
}

func (Post) After

func (p Post) After(date time.Time) bool

func (Post) Before

func (p Post) Before(date time.Time) bool

func (Post) Compare

func (p Post) Compare(other Post) int

func (Post) Equal

func (p Post) Equal(other Post) bool

func (Post) IsZero

func (p Post) IsZero() bool

func (Post) Published

func (p Post) Published() bool

type UserProfile

type UserProfile struct {
	Birthday  time.Time
	Biography string
	Website   string
}

func (UserProfile) Age

func (u UserProfile) Age() int

Jump to

Keyboard shortcuts

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