Ejemplo n.º 1
0
func (t *BigIntType) Set(value interface{}) {
	if value != nil {
		t.valid, t.val = true, util.ToInt64(value)
	} else {
		t.valid, t.val = false, 0
	}
}
Ejemplo n.º 2
0
func (t *IntType) Set(value interface{}) {
	if value != nil {
		t.valid, t.val = true, int32(util.ToInt64(value))
	} else {
		t.valid, t.val = false, int32(0)
	}
}
Ejemplo n.º 3
0
func (t *TimestampType) UnmarshalJSON(data []byte) error {
	if data == nil {
		return nil
	}
	sVal := string(data)
	if sVal == `""` || sVal == "null" || sVal == `"0000-00-00+00:00:00"` {
		return nil
	}
	sVal = strings.Replace(sVal, "\"", "", -1)
	sVal = strings.Replace(sVal, "+", " ", -1)
	if sVal != "" {
		if strings.Contains(sVal, "-") {
			t.Set(sVal)
		} else {
			t.Set(time.Unix(util.ToInt64(sVal), 0).Add(9 * time.Hour)) //TODO Long値で取得した場合,UTC=>JSTへの変換が必要
		}
	}
	if log.IsDebugEnabled() {
		log.Debugf("UnmarshalJSON TimestampType: %v => %v", sVal, t)
	}
	return nil
}
Ejemplo n.º 4
0
func (e *Env) Int64() int64 {
	if e.hasValue() {
		return util.ToInt64(e.val)
	}
	return util.ToInt64(e.defVal)
}