app

package
v0.0.0-...-729bbdd Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorItemNotFound = errors.New("item not found")
	ErrorInvalidItem  = errors.New("item invalid")
)
View Source
var DB *gorm.DB

Functions

This section is empty.

Types

type Character

type Character struct {
	ID           string   `json:"id"`
	Name         string   `json:"name"`
	Height       string   `json:"height"`
	Mass         string   `json:"mass"`
	HairColor    string   `json:"hair_color"`
	SkinColor    string   `json:"skin_color"`
	EyeColor     string   `json:"eye_color"`
	BirthYear    string   `json:"birth_year"`
	Gender       string   `json:"gender"`
	Homeworld    string   `json:"homeworld"`
	FilmURLs     []string `json:"films"`
	SpeciesURLs  []string `json:"species"`
	VehicleURLs  []string `json:"vehicles"`
	StarshipURLs []string `json:"starships"`
	Created      string   `json:"created"`
	Edited       string   `json:"edited"`
	URL          string   `json:"url"`
}

type CharacterRepository

type CharacterRepository interface {
	GetCharacter(id string) (*Character, error)
	GetCharacters() (*[]Character, error)
	CreateCharacter(c *Character) (*Character, error)
	UpdateCharacter(c *Character) (*Character, error)
	DeleteCharacter(id string) error
}

type CharacterSerializer

type CharacterSerializer interface {
	Decode(input []byte) (*Character, error)
	Encode(input *Character) ([]byte, error)
}

type CharacterService

type CharacterService interface {
	GetCharacter(id string) (*Character, error)
	GetCharacters() (*[]Character, error)
	CreateCharacter(c *Character) (*Character, error)
	UpdateCharacter(c *Character) (*Character, error)
	DeleteCharacter(id string) error
}

func NewCharacterService

func NewCharacterService(characterRepo CharacterRepository) CharacterService

type Comment

type Comment struct {
	CommentID   string `json:"comment_id" gorm:"type:text"`
	MovieID     string `json:"movie_id" gorm:"type:text"`
	Message     string `json:"message" gorm:"type:text"`
	CommentorIP string `json:"commentor_ip" gorm:"type:text"`
	Created     int64  `json:"created" gorm:"type:text"`
	Edited      int64  `json:"edited" gorm:"type:text"`
	URL         string `json:"url"`
}

type CommentRepository

type CommentRepository interface {
	GetComment(id string) (*Comment, error)
	GetComments() (*[]Comment, error)
	CreateComment(c *Comment) (*Comment, error)
	UpdateComment(c *Comment) (*Comment, error)
	DeleteComment(id string) error
}

type CommentSerializer

type CommentSerializer interface {
	Decode(input []byte) (*Comment, error)
	Encode(input *Comment) ([]byte, error)
}

type CommentService

type CommentService interface {
	GetComment(id string) (*Comment, error)
	GetComments() (*[]Comment, error)
	CreateComment(c *Comment) (*Comment, error)
	UpdateComment(c *Comment) (*Comment, error)
	DeleteComment(id string) error
}

func NewcommentService

func NewcommentService(commentRepo CommentRepository) CommentService

type Movie

type Movie struct {
	ID           string   `json:"id"`
	Title        string   `json:"title"`
	OpeningCrawl string   `json:"opening_crawl"`
	Comments     []string `json:"comments"`
	Characters   []string `json:"characters"`
	Created      string   `json:"created"`
	Edited       string   `json:"edited"`
}

type MovieRepository

type MovieRepository interface {
	GetMovie(id string) (*Movie, error)
	GetMovies() (*[]Movie, error)
	CreateMovie(c *Movie) (*Movie, error)
	UpdateMovie(c *Movie) (*Movie, error)
	DeleteMovie(id string) error
	GetMovieComments(id string) (*[]Comment, error)
	GetMovieCharacters(id string) (*[]Character, error)
}

type MovieSerializer

type MovieSerializer interface {
	Decode(input []byte) (*Movie, error)
	Encode(input *Movie) ([]byte, error)
}

type MovieService

type MovieService interface {
	GetMovie(id string) (*Movie, error)
	GetMovies() (*[]Movie, error)
	CreateMovie(m *Movie) (*Movie, error)
	UpdateMovie(m *Movie) (*Movie, error)
	DeleteMovie(id string) error
	GetMovieComments(id string) (*[]Comment, error)
	GetMovieCharacters(id string) (*[]Character, error)
}

func NewMovieService

func NewMovieService(movieRepo MovieRepository) MovieService

Jump to

Keyboard shortcuts

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