domain

package
v0.0.0-...-2c8b9bc Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const UserDefaultImage string = "https://api.realworld.io/images/demo-avatar.png"

Variables

This section is empty.

Functions

This section is empty.

Types

type Article

type Article struct {
	ID            ID
	AuthorID      ID
	Title         string
	Slug          string
	Description   string
	Body          string
	CreatedAt     time.Time
	UpdatedAt     time.Time
	TagNames      []string
	Author        User
	IsFavorite    bool
	FavoriteCount int
}

func NewArticle

func NewArticle(arg Article) Article

func RandomArticle

func RandomArticle(author User) Article

func (*Article) SetTitle

func (article *Article) SetTitle(value string)

type ArticleFavorite

type ArticleFavorite struct {
	ArticleID ID
	UserID    ID
}

type ArticleFavoriteCount

type ArticleFavoriteCount struct {
	ArticleID ID
	Count     int
}

type ArticleTag

type ArticleTag struct {
	ArticleID ID
	TagID     ID
}

type Comment

type Comment struct {
	ID        ID
	ArticleID ID
	AuthorID  ID
	Body      string
	CreatedAt time.Time
	UpdatedAt time.Time
	Author    User
}

func NewComment

func NewComment(arg Comment) Comment

type ID

type ID string

func NewID

func NewID() ID

func ParseID

func ParseID(value string) (ID, error)

func RandomID

func RandomID() ID

func (ID) String

func (id ID) String() string

type Tag

type Tag struct {
	ID   ID
	Name string
}

func NewTag

func NewTag(arg Tag) Tag

type User

type User struct {
	ID         ID
	Email      string
	Username   string
	Password   string
	Image      string
	Bio        string
	CreatedAt  time.Time
	UpdatedAt  time.Time
	IsFollowed bool
	Token      string
}

func NewUser

func NewUser(arg User) (User, error)

func RandomUser

func RandomUser() User

func (*User) SetEmail

func (user *User) SetEmail(email string) error

func (*User) SetImageURL

func (user *User) SetImageURL(url string) error

func (*User) SetPassword

func (user *User) SetPassword(password string) error

func (*User) SetUsername

func (user *User) SetUsername(username string) error

type UserFollow

type UserFollow struct {
	FollowerID ID
	FolloweeID ID
}

func NewUserFollow

func NewUserFollow(arg UserFollow) (UserFollow, error)

Jump to

Keyboard shortcuts

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