Documentation
¶
Index ¶
- Constants
- Variables
- func AtoF(s string) float64
- func CheckIfFundExistsInDB(db *sqlx.DB, schemeCode string) (bool, error)
- func CreateErrorResponse(w http.ResponseWriter, statusCode int, message string)
- func FetchFundData(db *sqlx.DB, mutualFundID string, start, end time.Time, getFromDB bool) (models.JsonResponse, error)
- func FetchFundDataFromDB(db *sqlx.DB, schemeCode string, startDate, endDate time.Time) (models.JsonResponse, error)
- func FilterNAVDataByDate(data []models.NAVData, start, end time.Time) []models.NAVData
- func GenerateJsonResponseModel(meta models.MetaData, data []models.NAVData, start, end time.Time) models.JsonResponse
- func SetupDB() (*sqlx.DB, error)
- func ValidateRequest(mutualFundID, startDate, endDate string) (time.Time, time.Time, error)
- func WriteDataToDB(wg *sync.WaitGroup, db *sqlx.DB, apiResponse models.JsonResponse, ...)
Constants ¶
View Source
const BaseURL = "https://api.mfapi.in/mf/"
Define the base URL as a constant
View Source
const BatchSize = 1000
View Source
const ConcurrencyLimit = 8
Variables ¶
View Source
var DBHost = os.Getenv("DBHost")
View Source
var DBPassword = os.Getenv("DBPassword")
View Source
var DBUser = os.Getenv("DBUser")
View Source
var FundDB = os.Getenv("FundDB")
Functions ¶
func CheckIfFundExistsInDB ¶
func CreateErrorResponse ¶
func CreateErrorResponse(w http.ResponseWriter, statusCode int, message string)
createErrorResponse creates an error response with the given status code and message.
func FetchFundData ¶
func FetchFundDataFromDB ¶
func FilterNAVDataByDate ¶
FilterNAVDataByDate filters the NAV data based on the provided date range.
func GenerateJsonResponseModel ¶
func GenerateJsonResponseModel(meta models.MetaData, data []models.NAVData, start, end time.Time) models.JsonResponse
generates a successful json response model from upstream response model
func ValidateRequest ¶
func WriteDataToDB ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.