types

package
v0.0.0-...-fd46d7f Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2023 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatDiskSize

func FormatDiskSize(size DiskSize) string

FormatDiskSize turns a number of bytes into a disk size string.

func StrPtr

func StrPtr(s string) *string

StrPtr returns a pointer to a string.

Types

type CustomBool

type CustomBool bool

CustomBool allows a JSON boolean value to also be an integer.

func BoolPtr

func BoolPtr(s bool) *CustomBool

BoolPtr returns a pointer to a bool.

func (CustomBool) MarshalJSON

func (r CustomBool) MarshalJSON() ([]byte, error)

MarshalJSON converts a boolean to a JSON value.

func (CustomBool) Pointer

func (r CustomBool) Pointer() *CustomBool

Pointer returns a pointers.

func (*CustomBool) PointerBool

func (r *CustomBool) PointerBool() *bool

PointerBool returns a pointer to a boolean.

func (*CustomBool) UnmarshalJSON

func (r *CustomBool) UnmarshalJSON(b []byte) error

UnmarshalJSON converts a JSON value to a boolean.

type CustomCommaSeparatedList

type CustomCommaSeparatedList []string

CustomCommaSeparatedList allows a JSON string to also be a string array.

func (*CustomCommaSeparatedList) MarshalJSON

func (r *CustomCommaSeparatedList) MarshalJSON() ([]byte, error)

MarshalJSON converts a boolean to a JSON value.

func (*CustomCommaSeparatedList) UnmarshalJSON

func (r *CustomCommaSeparatedList) UnmarshalJSON(b []byte) error

UnmarshalJSON converts a JSON value to a boolean.

type CustomInt

type CustomInt int

CustomInt allows a JSON integer value to also be a string.

func (*CustomInt) UnmarshalJSON

func (r *CustomInt) UnmarshalJSON(b []byte) error

UnmarshalJSON converts a JSON value to an integer.

type CustomLineBreakSeparatedList

type CustomLineBreakSeparatedList []string

CustomLineBreakSeparatedList allows a multiline JSON string to also be a string array.

func (*CustomLineBreakSeparatedList) MarshalJSON

func (r *CustomLineBreakSeparatedList) MarshalJSON() ([]byte, error)

MarshalJSON converts a boolean to a JSON value.

func (*CustomLineBreakSeparatedList) UnmarshalJSON

func (r *CustomLineBreakSeparatedList) UnmarshalJSON(b []byte) error

UnmarshalJSON converts a JSON value to a boolean.

type CustomPrivileges

type CustomPrivileges []string

CustomPrivileges allows a JSON object of privileges to also be a string array.

func (*CustomPrivileges) MarshalJSON

func (r *CustomPrivileges) MarshalJSON() ([]byte, error)

MarshalJSON converts a boolean to a JSON value.

func (*CustomPrivileges) UnmarshalJSON

func (r *CustomPrivileges) UnmarshalJSON(b []byte) error

UnmarshalJSON converts a JSON value to a boolean.

type CustomTimestamp

type CustomTimestamp time.Time

CustomTimestamp allows a JSON boolean value to also be a unix timestamp.

func (CustomTimestamp) MarshalJSON

func (r CustomTimestamp) MarshalJSON() ([]byte, error)

MarshalJSON converts a timestamp to a JSON value.

func (*CustomTimestamp) UnmarshalJSON

func (r *CustomTimestamp) UnmarshalJSON(b []byte) error

UnmarshalJSON converts a JSON value to a timestamp.

type DiskSize

type DiskSize int64

DiskSize allows a JSON integer value to also be a string. This is mapped to `<DiskSize>` data type in Proxmox API. Represents a disk size in bytes.

func DiskSizeFromGigabytes

func DiskSizeFromGigabytes(size int) DiskSize

DiskSizeFromGigabytes creates a DiskSize from gigabytes.

func ParseDiskSize

func ParseDiskSize(size string) (DiskSize, error)

ParseDiskSize parses a disk size string into a number of bytes.

func (DiskSize) InGigabytes

func (r DiskSize) InGigabytes() int

InGigabytes returns the disk size in gigabytes.

func (DiskSize) InMegabytes

func (r DiskSize) InMegabytes() int

InMegabytes returns the disk size in megabytes.

func (DiskSize) MarshalJSON

func (r DiskSize) MarshalJSON() ([]byte, error)

MarshalJSON marshals a disk size into a Proxmox API `<DiskSize>` string.

func (DiskSize) String

func (r DiskSize) String() string

String returns the string representation of the disk size.

func (*DiskSize) UnmarshalJSON

func (r *DiskSize) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals a disk size from a Proxmox API `<DiskSize>` string.

Jump to

Keyboard shortcuts

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