array

package
v0.0.0-...-51ce559 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array interface {
	Isset(Scalar) bool
	Unset(Scalar)
	Count() int
}

Array encapsulates common methods for arrays. That means no Add/Edit/Push/Iter, because these are strongly typed. Only the ones using only scalar as an argument are here.

type Int

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

func NewInt

func NewInt(vals ...int) Int

func (*Int) Add

func (a *Int) Add(vals ...int) *Int

func (Int) At

func (a Int) At(k Scalar) int

func (Int) Count

func (a Int) Count() int

func (*Int) Edit

func (a *Int) Edit(k Scalar, v int) *Int

func (Int) Isset

func (a Int) Isset(k Scalar) bool

func (Int) Iter

func (a Int) Iter() []int

func (Int) KeyIter

func (a Int) KeyIter() []IntPair

func (*Int) Push

func (a *Int) Push(vals ...int) int

func (*Int) Unset

func (a *Int) Unset(k Scalar)

type IntPair

type IntPair struct {
	K Scalar
	V int
}

type Scalar

type Scalar string

Scalar well-defines a key for PHP associative array. It is a decorated string which can convert other types to string using PHP common conventions, like false => zero, NULL => "" and so on.

func NewScalar

func NewScalar(val interface{}) Scalar

NewScalar converts primitive data types and NULL to strng, which can be used to index a PHP array.

func (Scalar) IntValue

func (s Scalar) IntValue() (int, bool)

IntValue translates value of the scalar to int, if possible. This is used to find out what the next index in the array will be, if values are added using Add/Push.

type String

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

func NewString

func NewString(vals ...string) String

func (*String) Add

func (a *String) Add(vals ...string) *String

func (String) At

func (a String) At(k Scalar) string

func (String) Count

func (a String) Count() int

func (*String) Edit

func (a *String) Edit(k Scalar, v string) *String

func (String) Isset

func (a String) Isset(k Scalar) bool

func (String) Iter

func (a String) Iter() []string

func (String) KeyIter

func (a String) KeyIter() []StringPair

func (*String) Push

func (a *String) Push(vals ...string) int

func (*String) Unset

func (a *String) Unset(k Scalar)

type StringPair

type StringPair struct {
	K Scalar
	V string
}

Jump to

Keyboard shortcuts

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