Browse Source

Update godoc comments

tags/v1.0.0
Cameron Moore Bjørn Erik Pedersen 7 years ago
parent
commit
e71c5a68f1
1 changed files with 21 additions and 19 deletions
  1. +21
    -19
      caste.go

+ 21
- 19
caste.go View File

@@ -14,7 +14,7 @@ import (
"time"
)

// ToTimeE casts an empty interface to time.Time.
// ToTimeE casts an interface to a time.Time type.
func ToTimeE(i interface{}) (tim time.Time, err error) {
i = indirect(i)

@@ -38,7 +38,7 @@ func ToTimeE(i interface{}) (tim time.Time, err error) {
}
}

// ToDurationE casts an empty interface to time.Duration.
// ToDurationE casts an interface to a time.Duration type.
func ToDurationE(i interface{}) (d time.Duration, err error) {
i = indirect(i)

@@ -64,7 +64,7 @@ func ToDurationE(i interface{}) (d time.Duration, err error) {
}
}

// ToBoolE casts an empty interface to a bool.
// ToBoolE casts an interface to a bool type.
func ToBoolE(i interface{}) (bool, error) {

i = indirect(i)
@@ -86,7 +86,7 @@ func ToBoolE(i interface{}) (bool, error) {
}
}

// ToFloat64E casts an empty interface to a float64.
// ToFloat64E casts an interface to a float64 type.
func ToFloat64E(i interface{}) (float64, error) {
i = indirect(i)

@@ -116,7 +116,7 @@ func ToFloat64E(i interface{}) (float64, error) {
}
}

// ToInt64E casts an empty interface to an int64.
// ToInt64E casts an interface to an int64 type.
func ToInt64E(i interface{}) (int64, error) {
i = indirect(i)

@@ -151,7 +151,7 @@ func ToInt64E(i interface{}) (int64, error) {
}
}

// ToInt32E casts an empty interface to an int32.
// ToInt32E casts an interface to an int32 type.
func ToInt32E(i interface{}) (int32, error) {
i = indirect(i)

@@ -186,7 +186,7 @@ func ToInt32E(i interface{}) (int32, error) {
}
}

// ToInt16E casts an empty interface to an int16.
// ToInt16E casts an interface to an int16 type.
func ToInt16E(i interface{}) (int16, error) {
i = indirect(i)

@@ -221,7 +221,7 @@ func ToInt16E(i interface{}) (int16, error) {
}
}

// ToInt8E casts an empty interface to an int8.
// ToInt8E casts an interface to an int8 type.
func ToInt8E(i interface{}) (int8, error) {
i = indirect(i)

@@ -256,7 +256,7 @@ func ToInt8E(i interface{}) (int8, error) {
}
}

// ToIntE casts an empty interface to an int.
// ToIntE casts an interface to an int type.
func ToIntE(i interface{}) (int, error) {
i = indirect(i)

@@ -330,7 +330,7 @@ func indirectToStringerOrError(a interface{}) interface{} {
return v.Interface()
}

// ToStringE casts an empty interface to a string.
// ToStringE casts an interface to a string type.
func ToStringE(i interface{}) (string, error) {
i = indirectToStringerOrError(i)

@@ -368,7 +368,7 @@ func ToStringE(i interface{}) (string, error) {
}
}

// ToStringMapStringE casts an empty interface to a map[string]string.
// ToStringMapStringE casts an interface to a map[string]string type.
func ToStringMapStringE(i interface{}) (map[string]string, error) {

var m = map[string]string{}
@@ -396,7 +396,7 @@ func ToStringMapStringE(i interface{}) (map[string]string, error) {
}
}

// ToStringMapStringSliceE casts an empty interface to a map[string][]string.
// ToStringMapStringSliceE casts an interface to a map[string][]string type.
func ToStringMapStringSliceE(i interface{}) (map[string][]string, error) {

var m = map[string][]string{}
@@ -458,7 +458,7 @@ func ToStringMapStringSliceE(i interface{}) (map[string][]string, error) {
return m, nil
}

// ToStringMapBoolE casts an empty interface to a map[string]bool.
// ToStringMapBoolE casts an interface to a map[string]bool type.
func ToStringMapBoolE(i interface{}) (map[string]bool, error) {

var m = map[string]bool{}
@@ -481,7 +481,7 @@ func ToStringMapBoolE(i interface{}) (map[string]bool, error) {
}
}

// ToStringMapE casts an empty interface to a map[string]interface{}.
// ToStringMapE casts an interface to a map[string]interface{} type.
func ToStringMapE(i interface{}) (map[string]interface{}, error) {

var m = map[string]interface{}{}
@@ -499,7 +499,7 @@ func ToStringMapE(i interface{}) (map[string]interface{}, error) {
}
}

// ToSliceE casts an empty interface to a []interface{}.
// ToSliceE casts an interface to a []interface{} type.
func ToSliceE(i interface{}) ([]interface{}, error) {

var s []interface{}
@@ -520,7 +520,7 @@ func ToSliceE(i interface{}) ([]interface{}, error) {
}
}

// ToBoolSliceE casts an empty interface to a []bool.
// ToBoolSliceE casts an interface to a []bool type.
func ToBoolSliceE(i interface{}) ([]bool, error) {

if i == nil {
@@ -550,7 +550,7 @@ func ToBoolSliceE(i interface{}) ([]bool, error) {
}
}

// ToStringSliceE casts an empty interface to a []string.
// ToStringSliceE casts an interface to a []string type.
func ToStringSliceE(i interface{}) ([]string, error) {

var a []string
@@ -576,7 +576,7 @@ func ToStringSliceE(i interface{}) ([]string, error) {
}
}

// ToIntSliceE casts an empty interface to a []int.
// ToIntSliceE casts an interface to a []int type.
func ToIntSliceE(i interface{}) ([]int, error) {

if i == nil {
@@ -606,7 +606,9 @@ func ToIntSliceE(i interface{}) ([]int, error) {
}
}

// StringToDate casts an empty interface to a time.Time.
// StringToDate attempts to parse a string into a time.Time type using a
// predefined list of formats. If no suitable format is found, an error is
// returned.
func StringToDate(s string) (time.Time, error) {
return parseDateWith(s, []string{
time.RFC3339,


Loading…
Cancel
Save