gocast

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2025 License: ISC Imports: 6 Imported by: 3

README

GoCast Package

Package gocast provides utilities for type casting and conversion in Go. It defines an interface Caster with methods for converting values to various Go types, including primary types like bool, int, uint, float, and string, as well as slices of these types. The package also includes functions for casting values to these types and handling errors related to type conversion.

Installation

To install the gocast package, use the following command:

go get github.com/mekramy/gocast

Then, import the package in your Go code:

import (
    "github.com/mekramy/gocast"
)

Functions

The package provides functions for casting values to various types and handling errors related to type conversion.

ToBool

func ToBool(value interface{}) (bool, error)

Casts an interface to a bool type.

ToSigned

func ToSigned[T int | int8 | int16 | int32 | int64](value interface{}) (T, error)

Casts an interface to a signed integer type.

ToUnsigned

func ToUnsigned[T uint | uint8 | uint16 | uint32 | uint64](value interface{}) (T, error)

Casts an interface to an unsigned integer type.

ToFloat

func ToFloat[T float32 | float64](value interface{}) (T, error)

Casts an interface to a float type.

ToString

func ToString(value interface{}) (string, error)

Casts an interface to a string type.

ToSlice

func ToSlice(value interface{}) ([]interface{}, error)

Casts an interface to a []interface{} type.

ToBoolSlice

func ToBoolSlice(i interface{}) ([]bool, error)

Casts an interface to a []bool type.

ToSignedSlice

func ToSignedSlice[T int | int8 | int16 | int32 | int64](i interface{}) ([]T, error)

Casts an interface to a signed integer slice type.

ToUnsignedSlice

func ToUnsignedSlice[T uint | uint8 | uint16 | uint32 | uint64](i interface{}) ([]T, error)

Casts an interface to an unsigned integer slice type.

ToFloatSlice

func ToFloatSlice[T float32 | float64](i interface{}) ([]T, error)

Casts an interface to a float slice type.

ToStringSlice

func ToStringSlice(i interface{}) ([]string, error)

Casts an interface to a []string type.

Functions Usage
package main

import (
    "fmt"
    "github.com/mekramy/gocast"
)

func main() {
    // Example of ToBool
    boolValue, err := gocast.ToBool("true")
    if err != nil {
        fmt.Println("Error:", err)
    } else {
        fmt.Println("Bool value:", boolValue) // output: true
    }

    // Example of ToSigned
    intValue, err := gocast.ToSigned[int]("-123.32")
    if err != nil {
        fmt.Println("Error:", err)
    } else {
        fmt.Println("Int value:", intValue) // output: 123
    }

    // Example of ToString
    stringValue, err := gocast.ToString(123)
    if err != nil {
        fmt.Println("Error:", err)
    } else {
        fmt.Println("String value:", stringValue) // output: "123"
    }
}

Caster Interface

The Caster interface provides methods for type casting and conversion. It includes methods for checking if a value is nil, retrieving the value as an interface, and converting the value to primary Go types such as bool, int, uint, float, and string. Each type conversion method has a corresponding safe method that returns a fallback value in case of an error, and methods for converting to slices of each type.

Methods
  • IsNil() bool: Checks if the value is nil.
  • Interface() any: Returns the value as an interface{}.
  • Unmarshal(out any) error: Unmarshals the value using a JSON decoder.
  • Bool() (bool, error): Converts the value to a bool.
  • BoolSafe(fallback bool) bool: Converts the value to a bool, returning a fallback value in case of an error.
  • Int() (int, error): Converts the value to an int.
  • IntSafe(fallback int) int: Converts the value to an int, returning a fallback value in case of an error.
  • Int8() (int8, error): Converts the value to an int8.
  • Int8Safe(fallback int8) int8: Converts the value to an int8, returning a fallback value in case of an error.
  • Int16() (int16, error): Converts the value to an int16.
  • Int16Safe(fallback int16) int16: Converts the value to an int16, returning a fallback value in case of an error.
  • Int32() (int32, error): Converts the value to an int32.
  • Int32Safe(fallback int32) int32: Converts the value to an int32, returning a fallback value in case of an error.
  • Int64() (int64, error): Converts the value to an int64.
  • Int64Safe(fallback int64) int64: Converts the value to an int64, returning a fallback value in case of an error.
  • Uint() (uint, error): Converts the value to a uint.
  • UintSafe(fallback uint) uint: Converts the value to a uint, returning a fallback value in case of an error.
  • Uint8() (uint8, error): Converts the value to a uint8.
  • Uint8Safe(fallback uint8) uint8: Converts the value to a uint8, returning a fallback value in case of an error.
  • Uint16() (uint16, error): Converts the value to a uint16.
  • Uint16Safe(fallback uint16) uint16: Converts the value to a uint16, returning a fallback value in case of an error.
  • Uint32() (uint32, error): Converts the value to a uint32.
  • Uint32Safe(fallback uint32) uint32: Converts the value to a uint32, returning a fallback value in case of an error.
  • Uint64() (uint64, error): Converts the value to a uint64.
  • Uint64Safe(fallback uint64) uint64: Converts the value to a uint64, returning a fallback value in case of an error.
  • Float32() (float32, error): Converts the value to a float32.
  • Float32Safe(fallback float32) float32: Converts the value to a float32, returning a fallback value in case of an error.
  • Float64() (float64, error): Converts the value to a float64.
  • Float64Safe(fallback float64) float64: Converts the value to a float64, returning a fallback value in case of an error.
  • String() (string, error): Converts the value to a string.
  • StringSafe(fallback string) string: Converts the value to a string, returning a fallback value in case of an error.
  • Slice() ([]any, error): Returns the value as a slice of interface{}.
  • SliceSafe(fallback []any) []any: Returns the value as a slice of interface{}, returning a fallback value in case of an error.
  • BoolSlice() ([]bool, error): Converts the value to a slice of bool.
  • BoolSliceSafe(fallback []bool) []bool: Converts the value to a slice of bool, returning a fallback value in case of an error.
  • IntSlice() ([]int, error): Converts the value to a slice of int.
  • IntSliceSafe(fallback []int) []int: Converts the value to a slice of int, returning a fallback value in case of an error.
  • Int8Slice() ([]int8, error): Converts the value to a slice of int8.
  • Int8SliceSafe(fallback []int8) []int8: Converts the value to a slice of int8, returning a fallback value in case of an error.
  • Int16Slice() ([]int16, error): Converts the value to a slice of int16.
  • Int16SliceSafe(fallback []int16) []int16: Converts the value to a slice of int16, returning a fallback value in case of an error.
  • Int32Slice() ([]int32, error): Converts the value to a slice of int32.
  • Int32SliceSafe(fallback []int32) []int32: Converts the value to a slice of int32, returning a fallback value in case of an error.
  • Int64Slice() ([]int64, error): Converts the value to a slice of int64.
  • Int64SliceSafe(fallback []int64) []int64: Converts the value to a slice of int64, returning a fallback value in case of an error.
  • UintSlice() ([]uint, error): Converts the value to a slice of uint.
  • UintSliceSafe(fallback []uint) []uint: Converts the value to a slice of uint, returning a fallback value in case of an error.
  • Uint8Slice() ([]uint8, error): Converts the value to a slice of uint8.
  • Uint8SliceSafe(fallback []uint8) []uint8: Converts the value to a slice of uint8, returning a fallback value in case of an error.
  • Uint16Slice() ([]uint16, error): Converts the value to a slice of uint16.
  • Uint16SliceSafe(fallback []uint16) []uint16: Converts the value to a slice of uint16, returning a fallback value in case of an error.
  • Uint32Slice() ([]uint32, error): Converts the value to a slice of uint32.
  • Uint32SliceSafe(fallback []uint32) []uint32: Converts the value to a slice of uint32, returning a fallback value in case of an error.
  • Uint64Slice() ([]uint64, error): Converts the value to a slice of uint64.
  • Uint64SliceSafe(fallback []uint64) []uint64: Converts the value to a slice of uint64, returning a fallback value in case of an error.
  • Float32Slice() ([]float32, error): Converts the value to a slice of float32.
  • Float32SliceSafe(fallback []float32) []float32: Converts the value to a slice of float32, returning a fallback value in case of an error.
  • Float64Slice() ([]float64, error): Converts the value to a slice of float64.
  • Float64SliceSafe(fallback []float64) []float64: Converts the value to a slice of float64, returning a fallback value in case of an error.
  • StringSlice() ([]string, error): Converts the value to a slice of string.
  • StringSliceSafe(fallback []string) []string: Converts the value to a slice of string, returning a fallback value in case of an error.
Caster Usage
package main

import (
    "fmt"
    "github.com/mekramy/gocast"
)

// Parse int
var value interface{} = "asdfasdf"
caster := gocast.New(value)
intValue, err := caster.Int() // output: error
if err != nil {
    fmt.Println("Error:", err)
} else {
    fmt.Println("Int value:", intValue)
}

// Parse bool
var value interface{} = "1"
caster := gocast.New(value)
boolValue, err := caster.Bool()
if err != nil {
    fmt.Println("Error:", err)
} else {
    fmt.Println("Bool value:", boolValue) // output: true
}

// Parse string
var value interface{} = 123.392
caster := gocast.New(value)
stringValue, err := caster.String()
if err != nil {
    fmt.Println("Error:", err)
} else {
    fmt.Println("String value:", stringValue) // output: "123.392"
}

Errors

The package defines error handling functions for type conversion errors.

IsNilError

func IsNilError(err error) bool

Checks if the provided error is a nil error. Returns true if the error is not nil and is a nil error.

IsCastError

func IsCastError(err error) bool

Checks if the provided error is a casting error. Returns true if the error is not nil and is a casting error.

IsOverflowError

func IsOverflowError(err error) bool

Checks if the provided error is a overflow error. Returns true if the error is not nil and is a overflow error.

Providers

The library also defines several provider interfaces for different types and slices. These interfaces provide methods to converting custom types like standard go Stringer interface.

Slice Providers
  • SliceProvider: Provides a method to return a slice of any type.
  • SliceErrorProvider: Provides a method to return a slice of any type with an error.
Bool Providers
  • BoolProvider: Provides a method to return a boolean value.
  • BoolErrorProvider: Provides a method to return a boolean value with an error.
  • BoolSliceProvider: Provides a method to return a slice of boolean values.
  • BoolSliceErrorProvider: Provides a method to return a slice of boolean values with an error.
Int Providers
  • IntProvider: Provides a method to return an integer value.
  • IntErrorProvider: Provides a method to return an integer value with an error.
  • IntSliceProvider: Provides a method to return a slice of integer values.
  • IntSliceErrorProvider: Provides a method to return a slice of integer values with an error.
Int8 Providers
  • Int8Provider: Provides a method to return an int8 value.
  • Int8ErrorProvider: Provides a method to return an int8 value with an error.
  • Int8SliceProvider: Provides a method to return a slice of int8 values.
  • Int8SliceErrorProvider: Provides a method to return a slice of int8 values with an error.
Int16 Providers
  • Int16Provider: Provides a method to return an int16 value.
  • Int16ErrorProvider: Provides a method to return an int16 value with an error.
  • Int16SliceProvider: Provides a method to return a slice of int16 values.
  • Int16SliceErrorProvider: Provides a method to return a slice of int16 values with an error.
Int32 Providers
  • Int32Provider: Provides a method to return an int32 value.
  • Int32ErrorProvider: Provides a method to return an int32 value with an error.
  • Int32SliceProvider: Provides a method to return a slice of int32 values.
  • Int32SliceErrorProvider: Provides a method to return a slice of int32 values with an error.
Int64 Providers
  • Int64Provider: Provides a method to return an int64 value.
  • Int64ErrorProvider: Provides a method to return an int64 value with an error.
  • Int64SliceProvider: Provides a method to return a slice of int64 values.
  • Int64SliceErrorProvider: Provides a method to return a slice of int64 values with an error.
Uint Providers
  • UintProvider: Provides a method to return a uint value.
  • UintErrorProvider: Provides a method to return a uint value with an error.
  • UintSliceProvider: Provides a method to return a slice of uint values.
  • UintSliceErrorProvider: Provides a method to return a slice of uint values with an error.
Uint8 Providers
  • Uint8Provider: Provides a method to return a uint8 value.
  • Uint8ErrorProvider: Provides a method to return a uint8 value with an error.
  • Uint8SliceProvider: Provides a method to return a slice of uint8 values.
  • Uint8SliceErrorProvider: Provides a method to return a slice of uint8 values with an error.
Uint16 Providers
  • Uint16Provider: Provides a method to return a uint16 value.
  • Uint16ErrorProvider: Provides a method to return a uint16 value with an error.
  • Uint16SliceProvider: Provides a method to return a slice of uint16 values.
  • Uint16SliceErrorProvider: Provides a method to return a slice of uint16 values with an error.
Uint32 Providers
  • Uint32Provider: Provides a method to return a uint32 value.
  • Uint32ErrorProvider: Provides a method to return a uint32 value with an error.
  • Uint32SliceProvider: Provides a method to return a slice of uint32 values.
  • Uint32SliceErrorProvider: Provides a method to return a slice of uint32 values with an error.
Uint64 Providers
  • Uint64Provider: Provides a method to return a uint64 value.
  • Uint64ErrorProvider: Provides a method to return a uint64 value with an error.
  • Uint64SliceProvider: Provides a method to return a slice of uint64 values.
  • Uint64SliceErrorProvider: Provides a method to return a slice of uint64 values with an error.
Float32 Providers
  • Float32Provider: Provides a method to return a float32 value.
  • Float32ErrorProvider: Provides a method to return a float32 value with an error.
  • Float32SliceProvider: Provides a method to return a slice of float32 values.
  • Float32SliceErrorProvider: Provides a method to return a slice of float32 values with an error.
Float64 Providers
  • Float64Provider: Provides a method to return a float64 value.
  • Float64ErrorProvider: Provides a method to return a float64 value with an error.
  • Float64SliceProvider: Provides a method to return a slice of float64 values.
  • Float64SliceErrorProvider: Provides a method to return a slice of float64 values with an error.
String Providers
  • StringProvider: Provides a method to return a string value.
  • StringErrorProvider: Provides a method to return a string value with an error.
  • StringSliceProvider: Provides a method to return a slice of string values.
  • StringSliceErrorProvider: Provides a method to return a slice of string values with an error.

Documentation

Overview

From html/template/content.go Copyright 2011 The Go Authors. All rights reserved.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsCastError

func IsCastError(err error) bool

IsCastError checks if the provided error is a casting error. It returns true if the error is not nil and its a casting error.

func IsNilError

func IsNilError(err error) bool

IsNilError checks if the provided error is a bil error. It returns true if the error is not nil and its nil error.

func IsOverflowError

func IsOverflowError(err error) bool

IsOverflowError checks if the provided error is a overflow error. It returns true if the error is not nil and its a overflow error.

func ToBool

func ToBool(value interface{}) (bool, error)

ToBool casts an interface to a bool type.

func ToBoolSlice

func ToBoolSlice(i interface{}) ([]bool, error)

ToBoolSlice casts an interface to a []bool type.

func ToFloat

func ToFloat[T float32 | float64](value interface{}) (T, error)

ToFloat casts an interface to a float type.

func ToFloatSlice

func ToFloatSlice[T float32 | float64](i interface{}) ([]T, error)

ToFloatSlice casts an interface to a float slice type.

func ToSigned

func ToSigned[T int | int8 | int16 | int32 | int64](value interface{}) (T, error)

ToSigned casts an interface to a signed integer type.

func ToSignedSlice

func ToSignedSlice[T int | int8 | int16 | int32 | int64](i interface{}) ([]T, error)

ToSignedSlice casts an interface to a signed integer slice type.

func ToSlice

func ToSlice(value interface{}) ([]interface{}, error)

ToSlice casts an interface{} to a []interface{} type.

func ToString

func ToString(value interface{}) (string, error)

ToString casts an interface to a string type.

func ToStringSlice

func ToStringSlice(i interface{}) ([]string, error)

ToStringSlice casts an interface to a []string type.

func ToUnsigned

func ToUnsigned[T uint | uint8 | uint16 | uint32 | uint64](value interface{}) (T, error)

ToUnsigned casts an interface to a unsigned integer type.

func ToUnsignedSlice

func ToUnsignedSlice[T uint | uint8 | uint16 | uint32 | uint64](i interface{}) ([]T, error)

ToUnsignedSlice casts an interface to a unsigned integer slice type.

Types

type BoolErrorProvider

type BoolErrorProvider interface {
	Bool() (bool, error)
}

BoolErrorProvider is an interface that provides a method to return a boolean value with an error.

type BoolProvider

type BoolProvider interface {
	Bool() bool
}

BoolProvider is an interface that provides a method to return a boolean value.

type BoolSliceErrorProvider

type BoolSliceErrorProvider interface {
	BoolSlice() ([]bool, error)
}

BoolSliceErrorProvider is an interface that provides a method to return a slice of boolean values with an error.

type BoolSliceProvider

type BoolSliceProvider interface {
	BoolSlice() []bool
}

BoolSliceProvider is an interface that provides a method to return a slice of boolean values.

type Caster

type Caster interface {
	// IsNil checks if the value is nil.
	IsNil() bool

	// Interface returns the value as an interface{}.
	Interface() any

	// Unmarshal unmarshal value using json decoder.
	Unmarshal(out any) error

	// Bool converts the value to a bool.
	Bool() (bool, error)

	// BoolSafe converts the value to a bool, returning a fallback value in case of an error.
	BoolSafe(fallback bool) bool

	// Int converts the value to an int.
	Int() (int, error)

	// IntSafe converts the value to an int, returning a fallback value in case of an error.
	IntSafe(fallback int) int

	// Int8 converts the value to an int8.
	Int8() (int8, error)

	// Int8Safe converts the value to an int8, returning a fallback value in case of an error.
	Int8Safe(fallback int8) int8

	// Int16 converts the value to an int16.
	Int16() (int16, error)

	// Int16Safe converts the value to an int16, returning a fallback value in case of an error.
	Int16Safe(fallback int16) int16

	// Int32 converts the value to an int32.
	Int32() (int32, error)

	// Int32Safe converts the value to an int32, returning a fallback value in case of an error.
	Int32Safe(fallback int32) int32

	// Int64 converts the value to an int64.
	Int64() (int64, error)

	// Int64Safe converts the value to an int64, returning a fallback value in case of an error.
	Int64Safe(fallback int64) int64

	// Uint converts the value to a uint.
	Uint() (uint, error)

	// UintSafe converts the value to a uint, returning a fallback value in case of an error.
	UintSafe(fallback uint) uint

	// Uint8 converts the value to a uint8.
	Uint8() (uint8, error)

	// Uint8Safe converts the value to a uint8, returning a fallback value in case of an error.
	Uint8Safe(fallback uint8) uint8

	// Uint16 converts the value to a uint16.
	Uint16() (uint16, error)

	// Uint16Safe converts the value to a uint16, returning a fallback value in case of an error.
	Uint16Safe(fallback uint16) uint16

	// Uint32 converts the value to a uint32.
	Uint32() (uint32, error)

	// Uint32Safe converts the value to a uint32, returning a fallback value in case of an error.
	Uint32Safe(fallback uint32) uint32

	// Uint64 converts the value to a uint64.
	Uint64() (uint64, error)

	// Uint64Safe converts the value to a uint64, returning a fallback value in case of an error.
	Uint64Safe(fallback uint64) uint64

	// Float32 converts the value to a float32.
	Float32() (float32, error)

	// Float32Safe converts the value to a float32, returning a fallback value in case of an error.
	Float32Safe(fallback float32) float32

	// Float64 converts the value to a float64.
	Float64() (float64, error)

	// Float64Safe converts the value to a float64, returning a fallback value in case of an error.
	Float64Safe(fallback float64) float64

	// String converts the value to a string.
	String() (string, error)

	// StringSafe converts the value to a string, returning a fallback value in case of an error.
	StringSafe(fallback string) string

	// Slice returns the value as a slice of interface{}.
	Slice() ([]any, error)

	// Slice returns the value as a slice of interface{}.
	SliceSafe(fallback []any) []any

	// BoolSlice converts the value to a slice of bool.
	BoolSlice() ([]bool, error)

	// BoolSliceSafe converts the value to a slice of bool, returning a fallback value in case of an error.
	BoolSliceSafe(fallback []bool) []bool

	// IntSlice converts the value to a slice of int.
	IntSlice() ([]int, error)

	// IntSliceSafe converts the value to a slice of int, returning a fallback value in case of an error.
	IntSliceSafe(fallback []int) []int

	// Int8Slice converts the value to a slice of int8.
	Int8Slice() ([]int8, error)

	// Int8SliceSafe converts the value to a slice of int8, returning a fallback value in case of an error.
	Int8SliceSafe(fallback []int8) []int8

	// Int16Slice converts the value to a slice of int16.
	Int16Slice() ([]int16, error)

	// Int16SliceSafe converts the value to a slice of int16, returning a fallback value in case of an error.
	Int16SliceSafe(fallback []int16) []int16

	// Int32Slice converts the value to a slice of int32.
	Int32Slice() ([]int32, error)

	// Int32SliceSafe converts the value to a slice of int32, returning a fallback value in case of an error.
	Int32SliceSafe(fallback []int32) []int32

	// Int64Slice converts the value to a slice of int64.
	Int64Slice() ([]int64, error)

	// Int64SliceSafe converts the value to a slice of int64, returning a fallback value in case of an error.
	Int64SliceSafe(fallback []int64) []int64

	// UintSlice converts the value to a slice of uint.
	UintSlice() ([]uint, error)

	// UintSliceSafe converts the value to a slice of uint, returning a fallback value in case of an error.
	UintSliceSafe(fallback []uint) []uint

	// Uint8Slice converts the value to a slice of uint8.
	Uint8Slice() ([]uint8, error)

	// Uint8SliceSafe converts the value to a slice of uint8, returning a fallback value in case of an error.
	Uint8SliceSafe(fallback []uint8) []uint8

	// Uint16Slice converts the value to a slice of uint16.
	Uint16Slice() ([]uint16, error)

	// Uint16SliceSafe converts the value to a slice of uint16, returning a fallback value in case of an error.
	Uint16SliceSafe(fallback []uint16) []uint16

	// Uint32Slice converts the value to a slice of uint32.
	Uint32Slice() ([]uint32, error)

	// Uint32SliceSafe converts the value to a slice of uint32, returning a fallback value in case of an error.
	Uint32SliceSafe(fallback []uint32) []uint32

	// Uint64Slice converts the value to a slice of uint64.
	Uint64Slice() ([]uint64, error)

	// Uint64SliceSafe converts the value to a slice of uint64, returning a fallback value in case of an error.
	Uint64SliceSafe(fallback []uint64) []uint64

	// Float32Slice converts the value to a slice of float32.
	Float32Slice() ([]float32, error)

	// Float32SliceSafe converts the value to a slice of float32, returning a fallback value in case of an error.
	Float32SliceSafe(fallback []float32) []float32

	// Float64Slice converts the value to a slice of float64.
	Float64Slice() ([]float64, error)

	// Float64SliceSafe converts the value to a slice of float64, returning a fallback value in case of an error.
	Float64SliceSafe(fallback []float64) []float64

	// StringSlice converts the value to a slice of string.
	StringSlice() ([]string, error)

	// StringSliceSafe converts the value to a slice of string, returning a fallback value in case of an error.
	StringSliceSafe(fallback []string) []string
}

Caster is an interface that provides methods for type casting and conversion. It includes methods for checking if a value is nil, retrieving the value as an interface, and converting the value to primary go types such as bool, int, uint, float, and string. Each type conversion method has a corresponding safe method that returns a fallback value in case of an error, and methods for converting to slices of each type.

func NewCaster

func NewCaster(v interface{}) Caster

NewCaster creates a new instance of a Caster with the provided value. The value can be of any type and will be used for type casting and conversion through the methods defined in the Caster interface.

Parameters:

  • v: The value to be used for type casting and conversion.

Returns:

  • Caster: An instance of the Caster interface that provides methods for type casting and conversion.

type Float32ErrorProvider

type Float32ErrorProvider interface {
	Float32() (float32, error)
}

Float32ErrorProvider is an interface that provides a method to return a float32 value with an error.

type Float32Provider

type Float32Provider interface {
	Float32() float32
}

Float32Provider is an interface that provides a method to return a float32 value.

type Float32SliceErrorProvider

type Float32SliceErrorProvider interface {
	Float32Slice() ([]float32, error)
}

Float32SliceErrorProvider is an interface that provides a method to return a slice of float32 values with an error.

type Float32SliceProvider

type Float32SliceProvider interface {
	Float32Slice() []float32
}

Float32SliceProvider is an interface that provides a method to return a slice of float32 values.

type Float64ErrorProvider

type Float64ErrorProvider interface {
	Float64() (float64, error)
}

Float64ErrorProvider is an interface that provides a method to return a float64 value with an error.

type Float64Provider

type Float64Provider interface {
	Float64() float64
}

Float64Provider is an interface that provides a method to return a float64 value.

type Float64SliceErrorProvider

type Float64SliceErrorProvider interface {
	Float64Slice() ([]float64, error)
}

Float64SliceErrorProvider is an interface that provides a method to return a slice of float64 values with an error.

type Float64SliceProvider

type Float64SliceProvider interface {
	Float64Slice() []float64
}

Float64SliceProvider is an interface that provides a method to return a slice of float64 values.

type Int8ErrorProvider

type Int8ErrorProvider interface {
	Int8() (int8, error)
}

Int8ErrorProvider is an interface that provides a method to return an int8 value with an error.

type Int8Provider

type Int8Provider interface {
	Int8() int8
}

Int8Provider is an interface that provides a method to return an int8 value.

type Int8SliceErrorProvider

type Int8SliceErrorProvider interface {
	Int8Slice() ([]int8, error)
}

Int8SliceErrorProvider is an interface that provides a method to return a slice of int8 values with an error.

type Int8SliceProvider

type Int8SliceProvider interface {
	Int8Slice() []int8
}

Int8SliceProvider is an interface that provides a method to return a slice of int8 values.

type Int16ErrorProvider

type Int16ErrorProvider interface {
	Int16() (int16, error)
}

Int16ErrorProvider is an interface that provides a method to return an int16 value with an error.

type Int16Provider

type Int16Provider interface {
	Int16() int16
}

Int16Provider is an interface that provides a method to return an int16 value.

type Int16SliceErrorProvider

type Int16SliceErrorProvider interface {
	Int16Slice() ([]int16, error)
}

Int16SliceErrorProvider is an interface that provides a method to return a slice of int16 values with an error.

type Int16SliceProvider

type Int16SliceProvider interface {
	Int16Slice() []int16
}

Int16SliceProvider is an interface that provides a method to return a slice of int16 values.

type Int32ErrorProvider

type Int32ErrorProvider interface {
	Int32() (int32, error)
}

Int32ErrorProvider is an interface that provides a method to return an int32 value with an error.

type Int32Provider

type Int32Provider interface {
	Int32() int32
}

Int32Provider is an interface that provides a method to return an int32 value.

type Int32SliceErrorProvider

type Int32SliceErrorProvider interface {
	Int32Slice() ([]int32, error)
}

Int32SliceErrorProvider is an interface that provides a method to return a slice of int32 values with an error.

type Int32SliceProvider

type Int32SliceProvider interface {
	Int32Slice() []int32
}

Int32SliceProvider is an interface that provides a method to return a slice of int32 values.

type Int64ErrorProvider

type Int64ErrorProvider interface {
	Int64() (int64, error)
}

Int64ErrorProvider is an interface that provides a method to return an int64 value with an error.

type Int64Provider

type Int64Provider interface {
	Int64() int64
}

Int64Provider is an interface that provides a method to return an int64 value.

type Int64SliceErrorProvider

type Int64SliceErrorProvider interface {
	Int64Slice() ([]int64, error)
}

Int64SliceErrorProvider is an interface that provides a method to return a slice of int64 values with an error.

type Int64SliceProvider

type Int64SliceProvider interface {
	Int64Slice() []int64
}

Int64SliceProvider is an interface that provides a method to return a slice of int64 values.

type IntErrorProvider

type IntErrorProvider interface {
	Int() (int, error)
}

IntErrorProvider is an interface that provides a method to return an integer value with an error.

type IntProvider

type IntProvider interface {
	Int() int
}

IntProvider is an interface that provides a method to return an integer value.

type IntSliceErrorProvider

type IntSliceErrorProvider interface {
	IntSlice() ([]int, error)
}

IntSliceErrorProvider is an interface that provides a method to return a slice of integer values with an error.

type IntSliceProvider

type IntSliceProvider interface {
	IntSlice() []int
}

IntSliceProvider is an interface that provides a method to return a slice of integer values.

type SliceErrorProvider

type SliceErrorProvider interface {
	Slice() ([]any, error)
}

SliceErrorProvider is an interface that provides a method to return a slice of any type with an error.

type SliceProvider

type SliceProvider interface {
	Slice() []any
}

SliceProvider is an interface that provides a method to return a slice of any type.

type StringErrorProvider

type StringErrorProvider interface {
	String() (string, error)
}

StringErrorProvider is an interface that provides a method to return a string value with an error.

type StringProvider

type StringProvider interface {
	String() string
}

StringProvider is an interface that provides a method to return a string value.

type StringSliceErrorProvider

type StringSliceErrorProvider interface {
	StringSlice() ([]string, error)
}

StringSliceErrorProvider is an interface that provides a method to return a slice of string values with an error.

type StringSliceProvider

type StringSliceProvider interface {
	StringSlice() []string
}

StringSliceProvider is an interface that provides a method to return a slice of string values.

type Uint8ErrorProvider

type Uint8ErrorProvider interface {
	Uint8() (uint8, error)
}

Uint8ErrorProvider is an interface that provides a method to return a uint8 value with an error.

type Uint8Provider

type Uint8Provider interface {
	Uint8() uint8
}

Uint8Provider is an interface that provides a method to return a uint8 value.

type Uint8SliceErrorProvider

type Uint8SliceErrorProvider interface {
	Uint8Slice() ([]uint8, error)
}

Uint8SliceErrorProvider is an interface that provides a method to return a slice of uint8 values with an error.

type Uint8SliceProvider

type Uint8SliceProvider interface {
	Uint8Slice() []uint8
}

Uint8SliceProvider is an interface that provides a method to return a slice of uint8 values.

type Uint16ErrorProvider

type Uint16ErrorProvider interface {
	Uint16() (uint16, error)
}

Uint16ErrorProvider is an interface that provides a method to return a uint16 value with an error.

type Uint16Provider

type Uint16Provider interface {
	Uint16() uint16
}

Uint16Provider is an interface that provides a method to return a uint16 value.

type Uint16SliceErrorProvider

type Uint16SliceErrorProvider interface {
	Uint16Slice() ([]uint16, error)
}

Uint16SliceErrorProvider is an interface that provides a method to return a slice of uint16 values with an error.

type Uint16SliceProvider

type Uint16SliceProvider interface {
	Uint16Slice() []uint16
}

Uint16SliceProvider is an interface that provides a method to return a slice of uint16 values.

type Uint32ErrorProvider

type Uint32ErrorProvider interface {
	Uint32() (uint32, error)
}

Uint32ErrorProvider is an interface that provides a method to return a uint32 value with an error.

type Uint32Provider

type Uint32Provider interface {
	Uint32() uint32
}

Uint32Provider is an interface that provides a method to return a uint32 value.

type Uint32SliceErrorProvider

type Uint32SliceErrorProvider interface {
	Uint32Slice() ([]uint32, error)
}

Uint32SliceErrorProvider is an interface that provides a method to return a slice of uint32 values with an error.

type Uint32SliceProvider

type Uint32SliceProvider interface {
	Uint32Slice() []uint32
}

Uint32SliceProvider is an interface that provides a method to return a slice of uint32 values.

type Uint64ErrorProvider

type Uint64ErrorProvider interface {
	Uint64() (uint64, error)
}

Uint64ErrorProvider is an interface that provides a method to return a uint64 value with an error.

type Uint64Provider

type Uint64Provider interface {
	Uint64() uint64
}

Uint64Provider is an interface that provides a method to return a uint64 value.

type Uint64SliceErrorProvider

type Uint64SliceErrorProvider interface {
	Uint64Slice() ([]uint64, error)
}

Uint64SliceErrorProvider is an interface that provides a method to return a slice of uint64 values with an error.

type Uint64SliceProvider

type Uint64SliceProvider interface {
	Uint64Slice() []uint64
}

Uint64SliceProvider is an interface that provides a method to return a slice of uint64 values.

type UintErrorProvider

type UintErrorProvider interface {
	Uint() (uint, error)
}

UintErrorProvider is an interface that provides a method to return a uint value with an error.

type UintProvider

type UintProvider interface {
	Uint() uint
}

UintProvider is an interface that provides a method to return a uint value.

type UintSliceErrorProvider

type UintSliceErrorProvider interface {
	UintSlice() ([]uint, error)
}

UintSliceErrorProvider is an interface that provides a method to return a slice of uint values with an error.

type UintSliceProvider

type UintSliceProvider interface {
	UintSlice() []uint
}

UintSliceProvider is an interface that provides a method to return a slice of uint values.

Jump to

Keyboard shortcuts

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