Skip to content

Commit

Permalink
revoe
Browse files Browse the repository at this point in the history
  • Loading branch information
miskolee002 committed Sep 10, 2017
1 parent c67c510 commit f7e50a3
Show file tree
Hide file tree
Showing 19 changed files with 98 additions and 63 deletions.
4 changes: 3 additions & 1 deletion gotemplate_Bool.go → optional_Bool.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion gotemplate_Byte.go → optional_Byte.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion gotemplate_Float32.go → optional_Float32.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion gotemplate_Float64.go → optional_Float64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion gotemplate_Int.go → optional_Int.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion gotemplate_Int16.go → optional_Int16.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion gotemplate_Int32.go → optional_Int32.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion gotemplate_Int64.go → optional_Int64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion gotemplate_Int8.go → optional_Int8.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion gotemplate_String.go → optional_String.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion gotemplate_Uint.go → optional_Uint.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion gotemplate_Uint16.go → optional_Uint16.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion gotemplate_Uint32.go → optional_Uint32.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion gotemplate_Uint64.go → optional_Uint64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion gotemplate_Uint8.go → optional_Uint8.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion gotemplate_Uintptr.go → optional_Uintptr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions optional_scanner/utils.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package optional_scanner

import (
"errors"
"strconv"
)

func ScanBool(input string) (bool, error) {
return strconv.ParseBool(input)
}
func ScanInt(input string) (int64, error) {
return strconv.ParseInt(input, 10, 64)
}

func ScanUint(input string) (uint64, error) {
return strconv.ParseUint(input, 10, 64)
}

func ScanFloat(input string) (float64, error) {
return strconv.ParseFloat(input, 64)
}

func ScanString(input string) (string, error) {
return input, nil
}

func ScanByte(input string) (byte, error) {
if len(input) > 0 {
return byte(input[0]), nil
}
return 0, errors.New("nil string")
}
2 changes: 2 additions & 0 deletions templates/optional.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import (
"encoding/json"
"encoding/xml"
"fmt"
"github.com/imiskolee/optional/optional_scanner"
"time"
)

var _ = time.Time{}
var __ = optional_scanner.ScanBool

// template type Optional(T,scan)
type T string
Expand Down
Loading

0 comments on commit f7e50a3

Please sign in to comment.