pollsweb

package module
v0.0.0-...-5881286 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

README

pollsweb

A webinterface for gopolls

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPollWeb = internalErrorSentinelType{}

ErrPollWeb is a constant that can be used with a type check. All internal errors can be used in a statement like errors.Is(err, ErrPollWeb) and return true. This can be useful when you want to distinguish between an error from gopollsweb and an "outside" error. If you want to dig deeper, for example find out if an error is of a special internal type, you should use errors.As(err, *ERROR_TYPE).

Functions

func GenUUID

func GenUUID() (uuid.UUID, error)

GenUUID generates a new UUID. The returned UUID is a random id, for consistent usage this function should always be called to generate UUIDs.

The returned error is (when not nil) of type UUIDGenError.

func InitLogger

func InitLogger(debug bool) (*zap.SugaredLogger, error)

func UTCNow

func UTCNow() time.Time

UTCNow returns the current time in UTC. For consistent usage this function should always be called to generate the current time.

Types

type PollWebError

type PollWebError struct{}

PollWebError is an error used for errors that should be considered a library internal error, such as verification errors. The type itself does not implement the error interface, but only the method Is(err error) from the error package. This way you can just embed this type in your own error type and Is(err, ErrPollWeb) will return true.

func (PollWebError) Is

func (pollErr PollWebError) Is(err error) bool

Is returns true if err == ErrPollWeb.

type StringSet

type StringSet map[string]struct{}

func NewStringSet

func NewStringSet(initialSize int) StringSet

func (StringSet) Add

func (s StringSet) Add(e string) bool

func (StringSet) Contains

func (s StringSet) Contains(e string) bool

func (StringSet) String

func (s StringSet) String() string

type TimeFormatTranslator

type TimeFormatTranslator struct {
	YearLong      string
	YearShort     string
	LongMonthStr  string
	ShortMonthStr string
	NumMonthLong  string
	NumMonthShort string
	WeekdayLong   string
	WeekdayShort  string
	DayLong       string
	DayShort      string
	Hour24        string
	Hour12Long    string
	Hour12Short   string
	MinuteLong    string
	MinuteShort   string
	SecondLong    string
	SecondShort   string
	PMCapital     string
	PMLower       string
	TZ            string
	NumColonTZ    string
	NumTZLong     string
	NumTZShort    string
	// contains filtered or unexported fields
}
var MomentJSDateFormatter *TimeFormatTranslator

func NewTimeFormatTranslator

func NewTimeFormatTranslator() *TimeFormatTranslator

func (*TimeFormatTranslator) ConvertFormat

func (f *TimeFormatTranslator) ConvertFormat(goFormat string) string

type UUIDGenError

type UUIDGenError struct {
	PollWebError
	Wrapped error
}

UUIDGenError is an error returned whenever we're not able a UUID. This should never happen.

func NewUUIDGenError

func NewUUIDGenError(err error) UUIDGenError

NewUUIDGenError returns a new UUIDGenError given the wrapped error.

func (UUIDGenError) Error

func (err UUIDGenError) Error() string

func (UUIDGenError) Unwrap

func (err UUIDGenError) Unwrap() error

type UUIDSet

type UUIDSet map[uuid.UUID]struct{}

func NewUUIDSet

func NewUUIDSet(initialSize int) UUIDSet

func (UUIDSet) Add

func (s UUIDSet) Add(e uuid.UUID) bool

func (UUIDSet) Contains

func (s UUIDSet) Contains(e uuid.UUID) bool

func (UUIDSet) String

func (s UUIDSet) String() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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