Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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 ¶
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)
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 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