utl

package
v0.0.0-...-7fcd714 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: Unlicense Imports: 16 Imported by: 7

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 GetSource

func GetSource(url string, srcRaw interface{}) error

FileExists returns whether a file exists

func GetSourceHeadersAPIkey

func GetSourceHeadersAPIkey(apiKey, url string, srcRaw interface{})

FileExists returns whether a file exists

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 RemoveDuplicateInt

func RemoveDuplicateInt(intSlice []int) []int

func RemoveDuplicateStr

func RemoveDuplicateStr(strSlice []string) []string

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)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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