func (d *defaulter) AsInt64(v Valuer, dv int64) int64 {
	value, err := v.Value()
	if err != nil {
		d.logValuerError(err)
		return dv
	}
	ivalue, err := strconv.ParseInt(value, 10, 64)
	if err != nil {
		d.logFormatError("int64", err)
		return dv
	}
	return int64(ivalue)
}
AsInt64 implements Defaulter.
package stringex
import (
	"errors"
	"fmt"
	"strconv"
	"strings"
	"time"
	"github.com/tideland/golib/logger"
)
type Defaulter interface {
	fmt.Stringer
	AsString(v Valuer, dv string) string
	AsStringSlice(v Valuer, sep string, dv []string) []string
	AsStringMap(v Valuer, rsep, kvsep string, dv map[string]string) map[string]string
	AsBool(v Valuer, dv bool) bool
	AsInt(v Valuer, dv int) int
	AsInt64(v Valuer, dv int64) int64
	AsUint(v Valuer, dv uint) uint
	AsUint64(v Valuer, dv uint64) uint64
	AsFloat64(v Valuer, dv float64) float64
	AsTime(v Valuer, layout string, dv time.Time) time.Time
	AsDuration(v Valuer, dv time.Duration) time.Duration
}
type defaulter struct {
	id  string
	log bool
}
func NewDefaulter(id string, log bool) Defaulter {
	return &defaulter{
		id:  id,
		log: log,
	}
}
func (d *defaulter) AsString(v Valuer, dv string) string {
	value, err := v.Value()
	if err != nil {
		d.logValuerError(err)
		return dv
	}
	return value
}
func (d *defaulter) AsStringSlice(v Valuer, sep string, dv []string) []string {
	value, err := v.Value()
	if err != nil {
		d.logValuerError(err)
		return dv
	}
	return strings.Split(value, sep)
}
func (d *defaulter) AsStringMap(v Valuer, rsep, kvsep string, dv map[string]string) map[string]string {
	value, err := v.Value()
	if err != nil {
		d.logValuerError(err)
		return dv
	}
	rows := strings.Split(value, rsep)
	mvalue := make(map[string]string, len(rows))
	for _, row := range rows {
		kv := strings.SplitN(row, kvsep, 2)
		if len(kv) == 2 {
			mvalue[kv[0]] = kv[1]
		} else {
			mvalue[kv[0]] = kv[0]
		}
	}
	return mvalue
}
func (d *defaulter) AsBool(v Valuer, dv bool) bool {
	value, err := v.Value()
	if err != nil {
		d.logValuerError(err)
		return dv
	}
	bvalue, err := strconv.ParseBool(value)
	if err != nil {
		d.logFormatError("bool", err)
		return dv
	}
	return bvalue
}
func (d *defaulter) AsInt(v Valuer, dv int) int {
	value, err := v.Value()
	if err != nil {
		d.logValuerError(err)
		return dv
	}
	ivalue, err := strconv.ParseInt(value, 10, 0)
	if err != nil {
		d.logFormatError("int", err)
		return dv
	}
	return int(ivalue)
}