utils

package
v1.0.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ReqPerSec = 199
	ApiGap    = time.Second / ReqPerSec
)

Variables

View Source
var (
	UserAgent     string          = "go-wiki"
	WikiLanguage  string          = "en"
	WikiURL       string          = "http://%v.wikipedia.org/w/api.php"
	LastCall      time.Time       = time.Now()
	Cache         cache.WikiCache = cache.MakeWikiCache()
	WikiRequester                 = RequestWikiApi
)

Functions

func CompareSlice

func CompareSlice(a, b []string) bool

Return true if 2 slices are the same

func CopyMap

func CopyMap(source map[string]string) map[string]string

Make a deep copy of a map[string]string

func HelpAddURL

func HelpAddURL(s string) string

func Isin

func Isin(list []string, s string) bool

Return true if string s is in list

func RequestWikiApi

func RequestWikiApi(args map[string]string) (models.RequestResult, error)

Make a request to the Wikipedia API using the given search parameters.

Returns a RequestResult (You can see the model in the models.go file)

func TurnSliceOfString

func TurnSliceOfString(s []interface{}) []string

func UpdateLastCall

func UpdateLastCall(now time.Time)

Update the last time we call the API (API should)

func UpdateMap

func UpdateMap(a map[string]string, b map[string]interface{})

Update map a using map b

Types

This section is empty.

Jump to

Keyboard shortcuts

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