utils

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2018 License: MIT Imports: 4 Imported by: 1

Documentation

Overview

Package utils implements helpers and utility functions for package database and models

Index

Constants

View Source
const (
	LetterBytes = "abcdefghijklmnopqrstuvwxyz"
)

Variables

This section is empty.

Functions

func CalculateGarbageCollectDate

func CalculateGarbageCollectDate(holdTimeInMonths int) time.Time

CalculateGarbageCollectDate is used to calculate the date at which a file will be removed from our inventory. To prepare data for input use `strconv.Atoi(fmt.Sprintf("%v", .....")"`

func GenerateMultiAddrFromString

func GenerateMultiAddrFromString(addr string) (ma.Multiaddr, error)

func ParsePeerIDFromIPFSMultiAddr

func ParsePeerIDFromIPFSMultiAddr(address ma.Multiaddr) (string, error)

Types

type RandomUtils

type RandomUtils struct {
	Seed       *rand.Rand
	SecureSeed *rand.Rand
}

RandomUtils is our helper struct for random related utilities

func GenerateRandomUtils

func GenerateRandomUtils() *RandomUtils

GenerateRandomUtils is used to generate our random utils struct

func (*RandomUtils) GenerateString

func (u *RandomUtils) GenerateString(length int, charset string) string

GenerateString is used to generate a fixed length random string from the specified charset, using a fresh seed each time

func (*RandomUtils) ReSeed

func (u *RandomUtils) ReSeed()

ReSeed is used to reseed our RNG

Jump to

Keyboard shortcuts

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