mirror of
https://github.com/MontFerret/ferret.git
synced 2025-08-15 20:02:56 +02:00
rename functions Parse<Type>P -> MustParse<Type>. while dined (#231)
This commit is contained in:
@@ -45,7 +45,7 @@ func ParseBoolean(input interface{}) (Boolean, error) {
|
|||||||
return False, core.Error(core.ErrInvalidType, "expected 'bool'")
|
return False, core.Error(core.ErrInvalidType, "expected 'bool'")
|
||||||
}
|
}
|
||||||
|
|
||||||
func ParseBooleanP(input interface{}) Boolean {
|
func MustParseBoolean(input interface{}) Boolean {
|
||||||
res, err := ParseBoolean(input)
|
res, err := ParseBoolean(input)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@@ -44,7 +44,7 @@ func ParseDateTimeWith(input interface{}, layout string) (DateTime, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ParseDateTimeP(input interface{}) DateTime {
|
func MustParseDateTime(input interface{}) DateTime {
|
||||||
dt, err := ParseDateTime(input)
|
dt, err := ParseDateTime(input)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@@ -4,10 +4,11 @@ import (
|
|||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/MontFerret/ferret/pkg/runtime/core"
|
|
||||||
"hash/fnv"
|
"hash/fnv"
|
||||||
"math"
|
"math"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/MontFerret/ferret/pkg/runtime/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Float float64
|
type Float float64
|
||||||
@@ -51,7 +52,7 @@ func ParseFloat(input interface{}) (Float, error) {
|
|||||||
return ZeroFloat, core.Error(core.ErrInvalidType, "expected 'float'")
|
return ZeroFloat, core.Error(core.ErrInvalidType, "expected 'float'")
|
||||||
}
|
}
|
||||||
|
|
||||||
func ParseFloatP(input interface{}) Float {
|
func MustParseFloat(input interface{}) Float {
|
||||||
res, err := ParseFloat(input)
|
res, err := ParseFloat(input)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@@ -50,7 +50,7 @@ func ParseInt(input interface{}) (Int, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ParseIntP(input interface{}) Int {
|
func MustParseInt(input interface{}) Int {
|
||||||
res, err := ParseInt(input)
|
res, err := ParseInt(input)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@@ -54,7 +54,7 @@ func ParseString(input interface{}) (String, error) {
|
|||||||
return EmptyString, core.Error(core.ErrInvalidType, "expected 'string'")
|
return EmptyString, core.Error(core.ErrInvalidType, "expected 'string'")
|
||||||
}
|
}
|
||||||
|
|
||||||
func ParseStringP(input interface{}) String {
|
func MustParseString(input interface{}) String {
|
||||||
res, err := ParseString(input)
|
res, err := ParseString(input)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user