Help us shape the future of Go! Take the 2026 Go Developer Survey

prizebond

package module
v0.0.0-...-4eea626 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2023 License: MIT Imports: 6 Imported by: 0

README

GO Package For Checking Bangladeshi Prizebond Number

Installation

Install the package using

$ go get github.com/mhshajib/bd-prizebond-checker
Usage

To use the package import it in your *.go code

import prizebond "github.com/mhshajib/bd-prizebond-checker"
Example

Note: The Example Numbers Are dummy Please Use Your Original Prizebond numbers to get proper results

You can add multiple bond numbers as array

package main

import (
	"fmt"

	prizebond "github.com/mhshajib/bd-prizebond-checker"
)

func init() {
	//Setting Prizebond Interface
	prizebond.Prizebond = &prizebond.PrizebondConnection{}

	prizebondNumbers := []string{"XXXXXXX"} //Place your prizebond number here

	//Initializing Bangladesh bank api as prizebond gateway
	prizebond.Prizebond.Init(prizebondNumbers)
}

func main() {
	var prizeBondData []map[string]string

	//Fetching prizebond data
	prizeBondData, err := prizebond.Prizebond.Fetch()
	if err != nil {
		//If some error happens during fetching results
		fmt.Println(err)
	}

	//API called successfully. Printing API Response in map.
	fmt.Println(prizeBondData)
}

You'll get response as map

License

The bd-prizebond-checker is an open-source software licensed under the MIT License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IPrizebond

type IPrizebond interface {
	Init(bondNumbers []string)
	Fetch() ([]map[string]string, error)
}

Interface of Prizebond

var Prizebond IPrizebond

use this variable to access the implementation of this interface

type PrizebondConnection

type PrizebondConnection struct {
	BaseUrl     string
	Url         string
	BondNumbers []string
}

Real implementation of Prizebond interface

func (*PrizebondConnection) Fetch

func (p *PrizebondConnection) Fetch() ([]map[string]string, error)

Fetch Prizebond Data

func (*PrizebondConnection) Init

func (p *PrizebondConnection) Init(bondNumbers []string)

Init prizebond with url

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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