Skip to main content
Version: 1.1.0 (current)

Get Juz Info

To get info about a Juz, you can use the GetJuzInfo method:

package main

import (
"fmt"
"log"

"github.com/Omar-Belghaouti/miracle"
"github.com/Omar-Belghaouti/miracle/ajzaa"
)

func main() {
// initialize the Quran struct and set the language to English
quran := miracle.Book()
quran.SetLanguage("en")

// get the info about the Juz 1
juzInfo, err := quran.GetJuzInfo(ajzaa.JUZ_1)
if err != nil {
log.Fatal(err.Error())
}
fmt.Println(juzInfo.Start)
}

The juz info is returned as a *miracle.Juz struct.

The parameter of the GetJuzInfo method is the Juz number and it must be between 1 and 30. For that there is a ajzaa package that provides the ajzaa numbers.

JuzInfo struct

type Juz struct {
Index string `json:"index"`
Start JuzPosition `json:"start"`
End JuzPosition `json:"end"`
}

type JuzPosition struct {
Index string `json:"index"`
Verse string `json:"verse"`
Name string `json:"name"`
}