utl

package
v0.0.0-...-032496f Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2021 License: Unlicense Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommonMiddleware

func CommonMiddleware(next http.Handler) http.Handler

CommonMiddleware --Set content-type

func DefaultErrorHandler

func DefaultErrorHandler(w http.ResponseWriter, status int)

func EnsureDir

func EnsureDir(fileName string) bool

EnsureDir checks a file could be written to a path, creates the directories as needed

func ErrorLog

func ErrorLog(err error)

func FileExists

func FileExists(filePath string) bool

FileExists returns whether a file exists

func GPFiles

func GPFiles(p string) (s []string)

GPFiles reads in the list of template files

func GetIP

func GetIP(s string) (ip, port string)

GetIP reads an IP from a string (this doesn't look to me like it is correctly written)

func GetJSON

func GetJSON(completeURL string) (interface{}, error)

GetJSON reads a JSON file and returns an map containing the parsed data

func InsertFloat

func InsertFloat(i interface{}) (f float64)

func InsertString

func InsertString(s string, i interface{}) string

func InsertStringInSlice

func InsertStringInSlice(s []string, i interface{}) []string

func InsertStringSlice

func InsertStringSlice(s []string, i interface{}) []string

func InterceptHandler

func InterceptHandler(next http.Handler, errH ErrorHandler) http.Handler

func MakeSlug

func MakeSlug(text string) string

MakeSlug slugifies a string. The result will only contain lowercase letters, digits and dashes. It will not begin or end with a dash, and it will not contain runs of multiple dashes.

It is NOT forced into being ASCII, but may contain any Unicode characters, with the above restrictions.

func SHA384

func SHA384(filename string) string

func Truncate

func Truncate(s string, l int) string

Types

type Endpoint

type Endpoint struct {
	User     string
	Password string
	Host     string
	Port     int64
}

Endpoint is the contact details for a JSONRPC endpoint

func NewClient

func NewClient(user string, password string, host string, port int64) *Endpoint

NewClient generates a new jsonRPC client

func (*Endpoint) MakeRequest

func (c *Endpoint) MakeRequest(method string, params interface{}) (interface{}, error)

MakeRequest queries a JSONRPC endpoint and returns a map of the response

type ErrorHandler

type ErrorHandler func(http.ResponseWriter, int)

type Images

type Images struct {
	Img16  string `json:"img16"`
	Img32  string `json:"img32"`
	Img64  string `json:"img64"`
	Img128 string `json:"img128"`
	Img256 string `json:"img256"`
}

Images is the list of differently scaled logo images for each coin

func GetIMG

func GetIMG(url, path, slug string) (i Images)

GetIMG loads a logo from the database and generates the various sized icons from it

Jump to

Keyboard shortcuts

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