Skip to main content
Version: 1.1.0 (current)

Get Surah Info

To get info about a Surah, you can use the GetSurahInfo method:

package main

import (
"fmt"
"log"

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

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

// get the info about the Surah Al-Fatiha
surahInfo, err := quran.GetSurahInfo(suar.AL_FATIHA)
if err != nil {
log.Fatal(err.Error())
}
fmt.Println(surahInfo.Title)
}

The surah info is returned as a *miracle.SurahInfo struct.

SurahInfo struct

type SurahInfo struct {
Place string `json:"place"`
Type string `json:"type"`
Count uint `json:"count"`
Title string `json:"title"`
TitleAr string `json:"titleAr"`
Index string `json:"index"`
Pages string `json:"pages"`
Juz []JuzInSurah `json:"juz"`
}

type JuzInSurah struct {
Index string `json:"index"`
Verse `json:"verse"`
}

type Verse struct {
Start string `json:"start"`
End string `json:"end"`
}