assets

package module
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: GPL-3.0 Imports: 8 Imported by: 1

README

GitHub release MIT license codecov lint workflow help wanted

The assets package

The package contain several useful functions.

Documentation

Overview

Package assets is a set of different useful functions for everyday use.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Byte2Bytes added in v1.0.8

func Byte2Bytes(num byte) []byte

Byte2Bytes converts a byte number to []byte.

func Byte2String added in v1.0.9

func Byte2String(num byte) string

Byte2String converts a byte number to string.

func Bytes2Byte added in v1.0.11

func Bytes2Byte(input []byte) (byte, error)

Bytes2Byte checks and converts input string as []byte to byte type.

func Bytes2Uint16 added in v1.0.12

func Bytes2Uint16(input []byte) (uint16, error)

Bytes2Uint16 checks and converts input string as []byte to uint16 type.

func Bytes2Uint32 added in v1.0.11

func Bytes2Uint32(input []byte) (uint32, error)

Bytes2Uint32 checks and converts input string as []byte to uint32 type.

func CheckName

func CheckName(name string) bool

CheckName check if an only allowed set of symbols is in the string.

func Date added in v1.0.5

func Date(year, day int, month time.Month) time.Time

Date is a shorter version of the time.Date() function.

func Days added in v1.0.5

func Days(month time.Time) int

Days returns number of days in a month.

func GenPassword

func GenPassword(length byte) string

GenPassword generates a password of a set length.

func GenPasswordAsBytes added in v1.2.0

func GenPasswordAsBytes(length byte) []byte

GenPasswordAsBytes generates a password of a set length.

func GetRandomByte added in v1.0.3

func GetRandomByte(max byte) byte

GetRandomByte generates a random byte number.

func IsCyrillicString added in v1.4.0

func IsCyrillicString(company string) bool

IsCyrillicString check if an only allowed set of symbols is in the company name.

func IsEmailValid added in v1.0.7

func IsEmailValid(email string) bool

IsEmailValid checks if the input email is valid.

func MultipleEqual

func MultipleEqual(booleans ...bool) (bool, error)

MultipleEqual checks all the bool parameters and returns a result.

func RemoveSafeQM

func RemoveSafeQM(str string) string

RemoveSafeQM removes symbols '\' before quotation marks.

func SafeQM

func SafeQM(str string) string

SafeQM escapes quotation marks adding '\' before them.

func SaveFile

func SaveFile(data interface{}, path string) error

SaveFile saves a file in JSON format.

func SetByte

func SetByte(inputByte *byte, inputString string) bool

SetByte checks and sets input string to a given pointer to byte type.

func SetUint16

func SetUint16(inputByte *uint16, inputString string) bool

SetUint16 checks and sets input string to a given pointer to uin16 type.

func SetUint32

func SetUint32(inputUint32 *uint32, inputString string) bool

SetUint32 checks and sets input string to a given pointer to uint32 type.

func String2Bool added in v1.1.0

func String2Bool(inputString string) bool

String2Bool converts input string to bool type.

func String2Byte added in v1.0.11

func String2Byte(input string) (byte, error)

String2Byte checks and converts input string to byte type.

func String2Uint16 added in v1.0.12

func String2Uint16(input string) (uint16, error)

String2Uint16 checks and converts input string to uint16 type.

func String2Uint32 added in v1.0.11

func String2Uint32(input string) (uint32, error)

String2Uint32 checks and converts input string to uint32 type.

func Uint162Bytes added in v1.0.8

func Uint162Bytes(num uint16) []byte

Uint162Bytes converts an uint16 number to string.

func Uint162String added in v1.0.10

func Uint162String(num uint16) string

Uint162String converts an uint16 number to string.

Types

type IntError added in v1.0.11

type IntError int

IntError - Error type based on int value.

const (
	ErrNotMoreThan255ValuesAreSupported IntError = 6 + iota
	ErrAtLeast2ValuesNeeded
)

func (IntError) Error added in v1.0.11

func (ie IntError) Error() string

Error returns error description.

type String

type String struct {
	Parameter string
	Ok        bool
}

String is an extended version of string type

func HTTPString

func HTTPString(input string) (output String)

HTTPString removes all leading and trailing white space and replace quotation marks with "

func (*String) SetStringByPointer

func (input *String) SetStringByPointer(output *string) bool

SetStringByPointer checks and sets input Strings parameter to a string through a pointer.

Jump to

Keyboard shortcuts

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