utils

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: MIT Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exists

func Exists(path string) bool

Exists provides a simple way to determine whether the item identified by a path actually exists either as a file or a folder

func FileExists

func FileExists(path string) bool

FileExists provides a simple way to determine whether the item identified by a path actually exists as a file

func FolderExists

func FolderExists(path string) bool

FileExists provides a simple way to determine whether the item identified by a path actually exists as a folder

func IsNil

func IsNil(i interface{}) bool

func Must added in v0.1.5

func Must(err error)

Must

func SplitParent

func SplitParent(path string) (d, f string)

Types

type PutProp

type PutProp[T any] interface {
	RwProp[T]
	Put(value T)
}

PutProp putter variable property interface. The putter allows the client to define assignment using a client defined function. The putter will still set the property's Field value.

func NewPutProp

func NewPutProp[T any](value T, putter func(value T)) PutProp[T]

NewPutProp create putter variable property

func NewPutPropZ

func NewPutPropZ[T any](value T, putter func(value T)) PutProp[T]

NewPutProp create putter variable and zeroable property

type PutPropFactory

type PutPropFactory[T any] struct {
	Zeroable bool
}

PutPropFactory putter variable property factory

func (PutPropFactory[T]) New

func (f PutPropFactory[T]) New(value T, putter func(value T)) PutProp[T]

New putter variable property constructor

type RoProp

type RoProp[T any] interface {
	Get() T
	IsNone() bool
}

RoProp const property interface.

func NewRoProp

func NewRoProp[T any](value T) RoProp[T]

NewRoProp create const property

type RoPropFactory

type RoPropFactory[T any] struct {
	Zeroable bool
}

RoPropFactory const property factory

func (RoPropFactory[T]) New

func (f RoPropFactory[T]) New(value T) RoProp[T]

New const property constructor

type RwProp

type RwProp[T any] interface {
	RoProp[T]
	Set(value T)
	IsZeroable() bool
	RoRef() RoProp[T]
}

RwProp variable property interface

func NewRwProp

func NewRwProp[T any](value T) RwProp[T]

NewRwProp create variable property

func NewRwPropZ

func NewRwPropZ[T any](value T) RwProp[T]

NewRwProp create variable and zeroable property

type RwPropFactory

type RwPropFactory[T any] struct {
	Zeroable bool
}

RwPropFactory variable property factory

func (RwPropFactory[T]) New

func (f RwPropFactory[T]) New(value T) RwProp[T]

New variable property constructor

type VarProp

type VarProp[T any] struct {
	Field T
	// contains filtered or unexported fields
}

VarProp a read/write property

func (*VarProp[T]) Get

func (p *VarProp[T]) Get() T

Get property value getter

func (*VarProp[T]) IsNone

func (p *VarProp[T]) IsNone() bool

IsNone determines whether the property has a value set

func (*VarProp[T]) IsZeroable

func (p *VarProp[T]) IsZeroable() bool

IsZeroable indicates whether a zero value is a valid value for this property

func (*VarProp[T]) RoRef

func (p *VarProp[T]) RoRef() RoProp[T]

RoRef returns a read only reference to this property

func (*VarProp[T]) Set

func (p *VarProp[T]) Set(value T)

Set property value setter

Jump to

Keyboard shortcuts

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