onchg

package
Version: v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2021 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package onchg implements values with a hook function that handles value changes. First the hook is called before a change is made with check=true. With check==true the hook decides if it blocks the set operation. To block the set operation, the hook returns 0. Otherwise the hook provides the change flags for the Set method. The flags from the hook are overridden if non-zero flags are passed to the value's Set method. If the hook is nil all Set methods of this package behave exactly like their chgv-package counterparts.

Set Methods

TODO: describe principle of Set methods.

Hook Functions

TODO: describe principle of hook functions.

Example
user := struct {
	Name   String
	Logins Int
}{
	Name: *NewString("John Doe", ChgFlag(1).String),
	Logins: *NewInt(0, func(_ *Int, o, n int, check bool) change.Flags {
		if !check {
			fmt.Printf("changed logins from %d to %d\n", o, n)
		}
		return 2
	}),
}

chg := user.Name.Set("John Doe", 0)
chg |= user.Logins.Set(1, 0)

fmt.Printf("Changes: 0b%b\n", chg)
if chg&1 == 0 {
	fmt.Println("Name did not change")
} else {
	fmt.Println("Name changed")
}
Output:

changed logins from 0 to 1
Changes: 0b10
Name did not change

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bool

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

Bool tracks changes of bool values with a hook and Flags. See also onchg package documentation.

func NewBool

func NewBool(init bool, hook BoolHook) *Bool

NewBool creates a change-detectable Bool. See also section Hook Funtions.

func (Bool) Get

func (cv Bool) Get() bool

Get returns the current bool value.

func (*Bool) Reset

func (cv *Bool) Reset(v bool, hook BoolHook) (bool, BoolHook)

Reset does not call a hook, even if the value changes. See also section Hook Funtions.

func (*Bool) Set

func (cv *Bool) Set(v bool, chg change.Flags) change.Flags

Set the value of cv to v. See also section Set Methods.

type BoolHook

type BoolHook func(src *Bool, ov, nv bool, check bool) change.Flags

See section Hook Funtions.

type BoolMultiHook added in v0.3.0

type BoolMultiHook []BoolHook

func (BoolMultiHook) Update added in v0.3.0

func (mh BoolMultiHook) Update(src *Bool, ov, nv bool, check bool) (chg change.Flags)

type Byte

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

Byte tracks changes of bool values with a hook and Flags. See also onchg package documentation.

func NewByte

func NewByte(init byte, hook ByteHook) *Byte

NewByte creates a change-detectable Byte. See also section Hook Funtions.

func (Byte) Get

func (cv Byte) Get() byte

Get returns the current byte value.

func (*Byte) Reset

func (cv *Byte) Reset(v byte, hook ByteHook) (byte, ByteHook)

Reset does not call a hook, even if the value changes. See also section Hook Funtions.

func (*Byte) Set

func (cv *Byte) Set(v byte, chg change.Flags) change.Flags

Set the value of cv to v. See also section Set Methods.

type ByteHook

type ByteHook func(src *Byte, ov, nv byte, check bool) change.Flags

See section Hook Funtions.

type ByteMultiHook added in v0.3.0

type ByteMultiHook []ByteHook

func (ByteMultiHook) Update added in v0.3.0

func (mh ByteMultiHook) Update(src *Byte, ov, nv byte, check bool) (chg change.Flags)

type ChgFlag

type ChgFlag change.Flags

ChgFlag is used to provide hooks that always return a Flags value. It is used to provide default Flags when the caller of a Set operation passes 0 Flags. Each method of ChgFlag is a type specific hook for a change-detectable value in package onchg.

func (ChgFlag) Bool

func (chg ChgFlag) Bool(src *Bool, _, _ bool, _ bool) change.Flags

Bool returns chg as change.Flags

func (ChgFlag) Byte

func (chg ChgFlag) Byte(src *Byte, _, _ byte, _ bool) change.Flags

Byte returns chg as change.Flags

func (ChgFlag) Complex128

func (chg ChgFlag) Complex128(src *Complex128, _, _ complex128, _ bool) change.Flags

Complex128 returns chg as change.Flags

func (ChgFlag) Complex64

func (chg ChgFlag) Complex64(src *Complex64, _, _ complex64, _ bool) change.Flags

Complex64 returns chg as change.Flags

func (ChgFlag) Duration added in v0.2.0

func (chg ChgFlag) Duration(src *Duration, _, _ bool, _ bool) change.Flags

time.Duration returns chg as change.Flags

func (ChgFlag) Float32

func (chg ChgFlag) Float32(src *Float32, _, _ float32, _ bool) change.Flags

Float32 returns chg as change.Flags

func (ChgFlag) Float64

func (chg ChgFlag) Float64(src *Float64, _, _ float64, _ bool) change.Flags

Float64 returns chg as change.Flags

func (ChgFlag) Int

func (chg ChgFlag) Int(src *Int, _, _ int, _ bool) change.Flags

Int returns chg as change.Flags

func (ChgFlag) Int16

func (chg ChgFlag) Int16(src *Int16, _, _ int16, _ bool) change.Flags

Int16 returns chg as change.Flags

func (ChgFlag) Int32

func (chg ChgFlag) Int32(src *Int32, _, _ int32, _ bool) change.Flags

Int32 returns chg as change.Flags

func (ChgFlag) Int64

func (chg ChgFlag) Int64(src *Int64, _, _ int64, _ bool) change.Flags

Int64 returns chg as change.Flags

func (ChgFlag) Int8

func (chg ChgFlag) Int8(src *Int8, _, _ int8, _ bool) change.Flags

Int8 returns chg as change.Flags

func (ChgFlag) Rune

func (chg ChgFlag) Rune(src *Rune, _, _ rune, _ bool) change.Flags

Rune returns chg as change.Flags

func (ChgFlag) String

func (chg ChgFlag) String(src *String, _, _ string, _ bool) change.Flags

String returns chg as change.Flags

func (ChgFlag) Time added in v0.2.0

func (chg ChgFlag) Time(src *Time, _, _ bool, _ bool) change.Flags

time.Time returns chg as change.Flags

func (ChgFlag) Uint

func (chg ChgFlag) Uint(src *Uint, _, _ uint, _ bool) change.Flags

Uint returns chg as change.Flags

func (ChgFlag) Uint16

func (chg ChgFlag) Uint16(src *Uint16, _, _ uint16, _ bool) change.Flags

Uint16 returns chg as change.Flags

func (ChgFlag) Uint32

func (chg ChgFlag) Uint32(src *Uint32, _, _ uint32, _ bool) change.Flags

Uint32 returns chg as change.Flags

func (ChgFlag) Uint64

func (chg ChgFlag) Uint64(src *Uint64, _, _ uint64, _ bool) change.Flags

Uint64 returns chg as change.Flags

func (ChgFlag) Uint8

func (chg ChgFlag) Uint8(src *Uint8, _, _ uint8, _ bool) change.Flags

Uint8 returns chg as change.Flags

func (ChgFlag) UintPtr

func (chg ChgFlag) UintPtr(src *UintPtr, _, _ uintptr, _ bool) change.Flags

UintPtr returns chg as change.Flags

type Complex128

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

Complex128 tracks changes of bool values with a hook and Flags. See also onchg package documentation.

func NewComplex128

func NewComplex128(init complex128, hook Complex128Hook) *Complex128

NewComplex128 creates a change-detectable Complex128. See also section Hook Funtions.

func (Complex128) Get

func (cv Complex128) Get() complex128

Get returns the current complex128 value.

func (*Complex128) Reset

Reset does not call a hook, even if the value changes. See also section Hook Funtions.

func (*Complex128) Set

func (cv *Complex128) Set(v complex128, chg change.Flags) change.Flags

Set the value of cv to v. See also section Set Methods.

type Complex128Hook

type Complex128Hook func(src *Complex128, ov, nv complex128, check bool) change.Flags

See section Hook Funtions.

type Complex128MultiHook added in v0.3.0

type Complex128MultiHook []Complex128Hook

func (Complex128MultiHook) Update added in v0.3.0

func (mh Complex128MultiHook) Update(src *Complex128, ov, nv complex128, check bool) (chg change.Flags)

type Complex64

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

Complex64 tracks changes of bool values with a hook and Flags. See also onchg package documentation.

func NewComplex64

func NewComplex64(init complex64, hook Complex64Hook) *Complex64

NewComplex64 creates a change-detectable Complex64. See also section Hook Funtions.

func (Complex64) Get

func (cv Complex64) Get() complex64

Get returns the current complex64 value.

func (*Complex64) Reset

Reset does not call a hook, even if the value changes. See also section Hook Funtions.

func (*Complex64) Set

func (cv *Complex64) Set(v complex64, chg change.Flags) change.Flags

Set the value of cv to v. See also section Set Methods.

type Complex64Hook

type Complex64Hook func(src *Complex64, ov, nv complex64, check bool) change.Flags

See section Hook Funtions.

type Complex64MultiHook added in v0.3.0

type Complex64MultiHook []Complex64Hook

func (Complex64MultiHook) Update added in v0.3.0

func (mh Complex64MultiHook) Update(src *Complex64, ov, nv complex64, check bool) (chg change.Flags)

type Duration added in v0.2.0

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

Duration tracks changes of bool values with a hook and Flags. See also onchg package documentation.

func NewDuration added in v0.2.0

func NewDuration(init time.Duration, hook DurationHook) *Duration

func (Duration) Get added in v0.2.0

func (cv Duration) Get() time.Duration

func (*Duration) Reset added in v0.2.0

func (*Duration) Set added in v0.2.0

func (cv *Duration) Set(v time.Duration, chg change.Flags) change.Flags

type DurationHook added in v0.2.0

type DurationHook func(src *Duration, ov, nv time.Duration, check bool) change.Flags

type DurationMultiHook added in v0.3.0

type DurationMultiHook []DurationHook

func (DurationMultiHook) Update added in v0.3.0

func (mh DurationMultiHook) Update(src *Duration, ov, nv time.Duration, check bool) (chg change.Flags)

type Float32

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

Float32 tracks changes of bool values with a hook and Flags. See also onchg package documentation.

func NewFloat32

func NewFloat32(init float32, hook Float32Hook) *Float32

NewFloat32 creates a change-detectable Float32. See also section Hook Funtions.

func (Float32) Get

func (cv Float32) Get() float32

Get returns the current float32 value.

func (*Float32) Reset

func (cv *Float32) Reset(v float32, hook Float32Hook) (float32, Float32Hook)

Reset does not call a hook, even if the value changes. See also section Hook Funtions.

func (*Float32) Set

func (cv *Float32) Set(v float32, chg change.Flags) change.Flags

Set the value of cv to v. See also section Set Methods.

type Float32Hook

type Float32Hook func(src *Float32, ov, nv float32, check bool) change.Flags

See section Hook Funtions.

type Float32MultiHook added in v0.3.0

type Float32MultiHook []Float32Hook

func (Float32MultiHook) Update added in v0.3.0

func (mh Float32MultiHook) Update(src *Float32, ov, nv float32, check bool) (chg change.Flags)

type Float64

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

Float64 tracks changes of bool values with a hook and Flags. See also onchg package documentation.

func NewFloat64

func NewFloat64(init float64, hook Float64Hook) *Float64

NewFloat64 creates a change-detectable Float64. See also section Hook Funtions.

func (Float64) Get

func (cv Float64) Get() float64

Get returns the current float64 value.

func (*Float64) Reset

func (cv *Float64) Reset(v float64, hook Float64Hook) (float64, Float64Hook)

Reset does not call a hook, even if the value changes. See also section Hook Funtions.

func (*Float64) Set

func (cv *Float64) Set(v float64, chg change.Flags) change.Flags

Set the value of cv to v. See also section Set Methods.

type Float64Hook

type Float64Hook func(src *Float64, ov, nv float64, check bool) change.Flags

See section Hook Funtions.

type Float64MultiHook added in v0.3.0

type Float64MultiHook []Float64Hook

func (Float64MultiHook) Update added in v0.3.0

func (mh Float64MultiHook) Update(src *Float64, ov, nv float64, check bool) (chg change.Flags)

type Int

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

Int tracks changes of bool values with a hook and Flags. See also onchg package documentation.

func NewInt

func NewInt(init int, hook IntHook) *Int

NewInt creates a change-detectable Int. See also section Hook Funtions.

func (Int) Get

func (cv Int) Get() int

Get returns the current int value.

func (*Int) Reset

func (cv *Int) Reset(v int, hook IntHook) (int, IntHook)

Reset does not call a hook, even if the value changes. See also section Hook Funtions.

func (*Int) Set

func (cv *Int) Set(v int, chg change.Flags) change.Flags

Set the value of cv to v. See also section Set Methods.

type Int16

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

Int16 tracks changes of bool values with a hook and Flags. See also onchg package documentation.

func NewInt16

func NewInt16(init int16, hook Int16Hook) *Int16

NewInt16 creates a change-detectable Int16. See also section Hook Funtions.

func (Int16) Get

func (cv Int16) Get() int16

Get returns the current int16 value.

func (*Int16) Reset

func (cv *Int16) Reset(v int16, hook Int16Hook) (int16, Int16Hook)

Reset does not call a hook, even if the value changes. See also section Hook Funtions.

func (*Int16) Set

func (cv *Int16) Set(v int16, chg change.Flags) change.Flags

Set the value of cv to v. See also section Set Methods.

type Int16Hook

type Int16Hook func(src *Int16, ov, nv int16, check bool) change.Flags

See section Hook Funtions.

type Int16MultiHook added in v0.3.0

type Int16MultiHook []Int16Hook

func (Int16MultiHook) Update added in v0.3.0

func (mh Int16MultiHook) Update(src *Int16, ov, nv int16, check bool) (chg change.Flags)

type Int32

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

Int32 tracks changes of bool values with a hook and Flags. See also onchg package documentation.

func NewInt32

func NewInt32(init int32, hook Int32Hook) *Int32

NewInt32 creates a change-detectable Int32. See also section Hook Funtions.

func (Int32) Get

func (cv Int32) Get() int32

Get returns the current int32 value.

func (*Int32) Reset

func (cv *Int32) Reset(v int32, hook Int32Hook) (int32, Int32Hook)

Reset does not call a hook, even if the value changes. See also section Hook Funtions.

func (*Int32) Set

func (cv *Int32) Set(v int32, chg change.Flags) change.Flags

Set the value of cv to v. See also section Set Methods.

type Int32Hook

type Int32Hook func(src *Int32, ov, nv int32, check bool) change.Flags

See section Hook Funtions.

type Int32MultiHook added in v0.3.0

type Int32MultiHook []Int32Hook

func (Int32MultiHook) Update added in v0.3.0

func (mh Int32MultiHook) Update(src *Int32, ov, nv int32, check bool) (chg change.Flags)

type Int64

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

Int64 tracks changes of bool values with a hook and Flags. See also onchg package documentation.

func NewInt64

func NewInt64(init int64, hook Int64Hook) *Int64

NewInt64 creates a change-detectable Int64. See also section Hook Funtions.

func (Int64) Get

func (cv Int64) Get() int64

Get returns the current int64 value.

func (*Int64) Reset

func (cv *Int64) Reset(v int64, hook Int64Hook) (int64, Int64Hook)

Reset does not call a hook, even if the value changes. See also section Hook Funtions.

func (*Int64) Set

func (cv *Int64) Set(v int64, chg change.Flags) change.Flags

Set the value of cv to v. See also section Set Methods.

type Int64Hook

type Int64Hook func(src *Int64, ov, nv int64, check bool) change.Flags

See section Hook Funtions.

type Int64MultiHook added in v0.3.0

type Int64MultiHook []Int64Hook

func (Int64MultiHook) Update added in v0.3.0

func (mh Int64MultiHook) Update(src *Int64, ov, nv int64, check bool) (chg change.Flags)

type Int8

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

Int8 tracks changes of bool values with a hook and Flags. See also onchg package documentation.

func NewInt8

func NewInt8(init int8, hook Int8Hook) *Int8

NewInt8 creates a change-detectable Int8. See also section Hook Funtions.

func (Int8) Get

func (cv Int8) Get() int8

Get returns the current int8 value.

func (*Int8) Reset

func (cv *Int8) Reset(v int8, hook Int8Hook) (int8, Int8Hook)

Reset does not call a hook, even if the value changes. See also section Hook Funtions.

func (*Int8) Set

func (cv *Int8) Set(v int8, chg change.Flags) change.Flags

Set the value of cv to v. See also section Set Methods.

type Int8Hook

type Int8Hook func(src *Int8, ov, nv int8, check bool) change.Flags

See section Hook Funtions.

type Int8MultiHook added in v0.3.0

type Int8MultiHook []Int8Hook

func (Int8MultiHook) Update added in v0.3.0

func (mh Int8MultiHook) Update(src *Int8, ov, nv int8, check bool) (chg change.Flags)

type IntHook

type IntHook func(src *Int, ov, nv int, check bool) change.Flags

See section Hook Funtions.

type IntMultiHook added in v0.3.0

type IntMultiHook []IntHook

func (IntMultiHook) Update added in v0.3.0

func (mh IntMultiHook) Update(src *Int, ov, nv int, check bool) (chg change.Flags)

type Rune

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

Rune tracks changes of bool values with a hook and Flags. See also onchg package documentation.

func NewRune

func NewRune(init rune, hook RuneHook) *Rune

NewRune creates a change-detectable Rune. See also section Hook Funtions.

func (Rune) Get

func (cv Rune) Get() rune

Get returns the current rune value.

func (*Rune) Reset

func (cv *Rune) Reset(v rune, hook RuneHook) (rune, RuneHook)

Reset does not call a hook, even if the value changes. See also section Hook Funtions.

func (*Rune) Set

func (cv *Rune) Set(v rune, chg change.Flags) change.Flags

Set the value of cv to v. See also section Set Methods.

type RuneHook

type RuneHook func(src *Rune, ov, nv rune, check bool) change.Flags

See section Hook Funtions.

type RuneMultiHook added in v0.3.0

type RuneMultiHook []RuneHook

func (RuneMultiHook) Update added in v0.3.0

func (mh RuneMultiHook) Update(src *Rune, ov, nv rune, check bool) (chg change.Flags)

type String

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

String tracks changes of bool values with a hook and Flags. See also onchg package documentation.

func NewString

func NewString(init string, hook StringHook) *String

NewString creates a change-detectable String. See also section Hook Funtions.

func (String) Get

func (cv String) Get() string

Get returns the current string value.

func (*String) Reset

func (cv *String) Reset(v string, hook StringHook) (string, StringHook)

Reset does not call a hook, even if the value changes. See also section Hook Funtions.

func (*String) Set

func (cv *String) Set(v string, chg change.Flags) change.Flags

Set the value of cv to v. See also section Set Methods.

type StringHook

type StringHook func(src *String, ov, nv string, check bool) change.Flags

See section Hook Funtions.

type StringMultiHook added in v0.3.0

type StringMultiHook []StringHook

func (StringMultiHook) Update added in v0.3.0

func (mh StringMultiHook) Update(src *String, ov, nv string, check bool) (chg change.Flags)

type Time added in v0.2.0

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

Time tracks changes of bool values with a hook and Flags. See also onchg package documentation.

func NewTime added in v0.2.0

func NewTime(init time.Time, hook TimeHook) *Time

func (Time) Get added in v0.2.0

func (cv Time) Get() time.Time

func (*Time) Reset added in v0.2.0

func (cv *Time) Reset(v time.Time, hook TimeHook) (time.Time, TimeHook)

func (*Time) Set added in v0.2.0

func (cv *Time) Set(v time.Time, chg change.Flags) change.Flags

type TimeHook added in v0.2.0

type TimeHook func(src *Time, ov, nv time.Time, check bool) change.Flags

type TimeMultiHook added in v0.3.0

type TimeMultiHook []TimeHook

func (TimeMultiHook) Update added in v0.3.0

func (mh TimeMultiHook) Update(src *Time, ov, nv time.Time, check bool) (chg change.Flags)

type Uint

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

Uint tracks changes of bool values with a hook and Flags. See also onchg package documentation.

func NewUint

func NewUint(init uint, hook UintHook) *Uint

NewUint creates a change-detectable Uint. See also section Hook Funtions.

func (Uint) Get

func (cv Uint) Get() uint

Get returns the current uint value.

func (*Uint) Reset

func (cv *Uint) Reset(v uint, hook UintHook) (uint, UintHook)

Reset does not call a hook, even if the value changes. See also section Hook Funtions.

func (*Uint) Set

func (cv *Uint) Set(v uint, chg change.Flags) change.Flags

Set the value of cv to v. See also section Set Methods.

type Uint16

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

Uint16 tracks changes of bool values with a hook and Flags. See also onchg package documentation.

func NewUint16

func NewUint16(init uint16, hook Uint16Hook) *Uint16

NewUint16 creates a change-detectable Uint16. See also section Hook Funtions.

func (Uint16) Get

func (cv Uint16) Get() uint16

Get returns the current uint16 value.

func (*Uint16) Reset

func (cv *Uint16) Reset(v uint16, hook Uint16Hook) (uint16, Uint16Hook)

Reset does not call a hook, even if the value changes. See also section Hook Funtions.

func (*Uint16) Set

func (cv *Uint16) Set(v uint16, chg change.Flags) change.Flags

Set the value of cv to v. See also section Set Methods.

type Uint16Hook

type Uint16Hook func(src *Uint16, ov, nv uint16, check bool) change.Flags

See section Hook Funtions.

type Uint16MultiHook added in v0.3.0

type Uint16MultiHook []Uint16Hook

func (Uint16MultiHook) Update added in v0.3.0

func (mh Uint16MultiHook) Update(src *Uint16, ov, nv uint16, check bool) (chg change.Flags)

type Uint32

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

Uint32 tracks changes of bool values with a hook and Flags. See also onchg package documentation.

func NewUint32

func NewUint32(init uint32, hook Uint32Hook) *Uint32

NewUint32 creates a change-detectable Uint32. See also section Hook Funtions.

func (Uint32) Get

func (cv Uint32) Get() uint32

Get returns the current uint32 value.

func (*Uint32) Reset

func (cv *Uint32) Reset(v uint32, hook Uint32Hook) (uint32, Uint32Hook)

Reset does not call a hook, even if the value changes. See also section Hook Funtions.

func (*Uint32) Set

func (cv *Uint32) Set(v uint32, chg change.Flags) change.Flags

Set the value of cv to v. See also section Set Methods.

type Uint32Hook

type Uint32Hook func(src *Uint32, ov, nv uint32, check bool) change.Flags

See section Hook Funtions.

type Uint32MultiHook added in v0.3.0

type Uint32MultiHook []Uint32Hook

func (Uint32MultiHook) Update added in v0.3.0

func (mh Uint32MultiHook) Update(src *Uint32, ov, nv uint32, check bool) (chg change.Flags)

type Uint64

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

Uint64 tracks changes of bool values with a hook and Flags. See also onchg package documentation.

func NewUint64

func NewUint64(init uint64, hook Uint64Hook) *Uint64

NewUint64 creates a change-detectable Uint64. See also section Hook Funtions.

func (Uint64) Get

func (cv Uint64) Get() uint64

Get returns the current uint64 value.

func (*Uint64) Reset

func (cv *Uint64) Reset(v uint64, hook Uint64Hook) (uint64, Uint64Hook)

Reset does not call a hook, even if the value changes. See also section Hook Funtions.

func (*Uint64) Set

func (cv *Uint64) Set(v uint64, chg change.Flags) change.Flags

Set the value of cv to v. See also section Set Methods.

type Uint64Hook

type Uint64Hook func(src *Uint64, ov, nv uint64, check bool) change.Flags

See section Hook Funtions.

type Uint64MultiHook added in v0.3.0

type Uint64MultiHook []Uint64Hook

func (Uint64MultiHook) Update added in v0.3.0

func (mh Uint64MultiHook) Update(src *Uint64, ov, nv uint64, check bool) (chg change.Flags)

type Uint8

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

Uint8 tracks changes of bool values with a hook and Flags. See also onchg package documentation.

func NewUint8

func NewUint8(init uint8, hook Uint8Hook) *Uint8

NewUint8 creates a change-detectable Uint8. See also section Hook Funtions.

func (Uint8) Get

func (cv Uint8) Get() uint8

Get returns the current uint8 value.

func (*Uint8) Reset

func (cv *Uint8) Reset(v uint8, hook Uint8Hook) (uint8, Uint8Hook)

Reset does not call a hook, even if the value changes. See also section Hook Funtions.

func (*Uint8) Set

func (cv *Uint8) Set(v uint8, chg change.Flags) change.Flags

Set the value of cv to v. See also section Set Methods.

type Uint8Hook

type Uint8Hook func(src *Uint8, ov, nv uint8, check bool) change.Flags

See section Hook Funtions.

type Uint8MultiHook added in v0.3.0

type Uint8MultiHook []Uint8Hook

func (Uint8MultiHook) Update added in v0.3.0

func (mh Uint8MultiHook) Update(src *Uint8, ov, nv uint8, check bool) (chg change.Flags)

type UintHook

type UintHook func(src *Uint, ov, nv uint, check bool) change.Flags

See section Hook Funtions.

type UintMultiHook added in v0.3.0

type UintMultiHook []UintHook

func (UintMultiHook) Update added in v0.3.0

func (mh UintMultiHook) Update(src *Uint, ov, nv uint, check bool) (chg change.Flags)

type UintPtr

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

UintPtr tracks changes of bool values with a hook and Flags. See also onchg package documentation.

func NewUintPtr

func NewUintPtr(init uintptr, hook UintPtrHook) *UintPtr

NewUintPtr creates a change-detectable UintPtr. See also section Hook Funtions.

func (UintPtr) Get

func (cv UintPtr) Get() uintptr

Get returns the current uintptr value.

func (*UintPtr) Reset

func (cv *UintPtr) Reset(v uintptr, hook UintPtrHook) (uintptr, UintPtrHook)

Reset does not call a hook, even if the value changes. See also section Hook Funtions.

func (*UintPtr) Set

func (cv *UintPtr) Set(v uintptr, chg change.Flags) change.Flags

Set the value of cv to v. See also section Set Methods.

type UintPtrHook

type UintPtrHook func(src *UintPtr, ov, nv uintptr, check bool) change.Flags

See section Hook Funtions.

type UintPtrMultiHook added in v0.3.0

type UintPtrMultiHook []UintPtrHook

func (UintPtrMultiHook) Update added in v0.3.0

func (mh UintPtrMultiHook) Update(src *UintPtr, ov, nv uintptr, check bool) (chg change.Flags)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL