playground

package
v1.15.5 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 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 added in v1.14.0

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

func (Author) FullName added in v1.14.1

func (a Author) FullName() string

func (Author) IsAdmin added in v1.14.1

func (a Author) IsAdmin() bool

type Blog added in v1.14.0

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

func ExampleData added in v1.14.1

func ExampleData() Blog

func (Blog) Add added in v1.14.1

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

func (Blog) HasTag added in v1.14.1

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

func (Blog) IsAdmin added in v1.14.1

func (Blog) IsAdmin(author Author) bool

func (Blog) IsZero added in v1.14.1

func (Blog) IsZero(post Post) bool

func (Blog) PopularPosts added in v1.14.1

func (b Blog) PopularPosts() []Post

func (Blog) RecentPosts added in v1.14.1

func (b Blog) RecentPosts() []Post

func (Blog) Sub added in v1.14.1

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

func (Blog) Title added in v1.14.1

func (Blog) Title(post Post) string

func (Blog) TotalComments added in v1.14.1

func (b Blog) TotalComments() int

func (Blog) TotalUpvotes added in v1.14.1

func (b Blog) TotalUpvotes() int

func (Blog) WithID added in v1.14.1

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

type Comment added in v1.14.0

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

func (Comment) AuthorEmail added in v1.14.1

func (c Comment) AuthorEmail() string

func (Comment) Upvoted added in v1.14.1

func (c Comment) Upvoted() bool

type Post added in v1.14.0

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

func (Post) After added in v1.14.1

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

func (Post) Before added in v1.14.1

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

func (Post) Compare added in v1.14.1

func (p Post) Compare(other Post) int

func (Post) Equal added in v1.14.1

func (p Post) Equal(other Post) bool

func (Post) IsZero added in v1.14.1

func (p Post) IsZero() bool

func (Post) Published added in v1.14.1

func (p Post) Published() bool

type UserProfile added in v1.14.0

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

func (UserProfile) Age added in v1.14.1

func (u UserProfile) Age() int

Jump to

Keyboard shortcuts

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