customtypes

package module
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: Apache-2.0 Imports: 8 Imported by: 2

README

go-customtypes

Custom types. Mostly useful for json/yaml (un)marshal

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Date added in v0.0.2

type Date time.Time

Date adds extra unmarshaling logic for time.Date

func (*Date) MarshalText added in v0.0.2

func (d *Date) MarshalText() ([]byte, error)

MarshalText marshals Date as string

func (*Date) String added in v0.0.2

func (d *Date) String() string

String returns the Date in the custom format

func (*Date) UnmarshalText added in v0.0.2

func (d *Date) UnmarshalText(b []byte) (err error)

UnmarshalText unmarshals text into a Date

type Regexp

type Regexp struct {
	*regexp.Regexp
}

Regexp adds unmarshalling from yaml for regexp.Regexp

func (*Regexp) MarshalText

func (r *Regexp) MarshalText() ([]byte, error)

MarshalText marshals regexp.Regexp as string

func (*Regexp) UnmarshalText

func (r *Regexp) UnmarshalText(b []byte) error

UnmarshalText unmarshals yaml into a regexp.Regexp

type SmartString added in v0.0.6

type SmartString struct {
	// contains filtered or unexported fields
}

func (*SmartString) MarshalText added in v0.0.6

func (ss *SmartString) MarshalText() (value []byte, err error)

func (*SmartString) MustString added in v0.0.7

func (ss *SmartString) MustString(properties *SmartStringProperties) string

func (*SmartString) String added in v0.0.6

func (ss *SmartString) String(properties *SmartStringProperties) (string, error)

func (*SmartString) UnmarshalText added in v0.0.6

func (ss *SmartString) UnmarshalText(b []byte) (err error)

type SmartStringProperties added in v0.0.8

type SmartStringProperties struct {
	String string
	Obj    interface{}
}

type TZLocation added in v0.0.4

type TZLocation time.Location

Date adds extra unmarshaling logic for TZLocation

func (*TZLocation) MarshalText added in v0.0.4

func (tzl *TZLocation) MarshalText() ([]byte, error)

MarshalText marshals TZLocation as string

func (*TZLocation) String added in v0.0.4

func (tzl *TZLocation) String() string

String returns the TZLocation as string

func (*TZLocation) UnmarshalText added in v0.0.4

func (tzl *TZLocation) UnmarshalText(b []byte) (err error)

UnmarshalText unmarshals text into a TZLocation

type Url added in v0.0.11

type Url url.URL

func (*Url) MarshalText added in v0.0.11

func (u *Url) MarshalText() ([]byte, error)

MarshalText marshals Url as string

func (*Url) String added in v0.0.11

func (u *Url) String() string

String returns the Url as a string

func (*Url) UnmarshalText added in v0.0.11

func (u *Url) UnmarshalText(b []byte) (err error)

UnmarshalText unmarshals text into an Url

Jump to

Keyboard shortcuts

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