Documentation ¶
Index ¶
Constants ¶
View Source
const ( DEFAULT_LIMIT_PER_PAGE int = 50 MAX_LIMIT_PER_PAGE int = 150 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hadith ¶
type Hadith struct { Number int `json:"number"` Text string `json:"arab"` Translate string `json:"id"` }
Hadith model to contain hadith text
type HadithCollection ¶
HadithCollextion an alias to collection of hadith from all hadith book
type Handler ¶
type Handler interface { GetAvailableBooks(c *fiber.Ctx) error GetHadithByBook(c *fiber.Ctx) error GetHadithByNumber(c *fiber.Ctx) error GetHadithRandom(c *fiber.Ctx) error }
Handler contains method for fiber route handlers
func NewHandler ¶
NewHandler is a function to instantiate new handler object
type Repository ¶
type Repository interface { GetAllBook() []Book GetAllHadith() HadithCollection }
Repository contains method to interact with data source
func NewRepository ¶
func NewRepository(data embed.FS) Repository
NewRepository is a function to instantiate new repository object
this function also retrieve all content of json files that containing collection of hadith. retrieved contents stored to repository object properties and used as the data source.
type Service ¶
type Service interface { GetAllAvailableBooks() []Book GetHadithByBook(bookName string, offset, limit int) (Book, []Hadith, error) GetHadithByNumber(bookName string, number int) (Book, Hadith, error) GetHadithRandom() (Book, Hadith, error) }
Service contains all business logic method
func NewService ¶
func NewService(repository Repository) Service
NewService is a function to instantiate new service object
Click to show internal directories.
Click to hide internal directories.