From 0868fe15987a741944adb6d87013ef1f8bf8d1fd Mon Sep 17 00:00:00 2001 From: brettlangdon Date: Sat, 20 Jun 2015 11:13:01 -0400 Subject: [PATCH] use 'primative' instead of 'this' --- primative.go | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/primative.go b/primative.go index 0018aa6..2dba30e 100644 --- a/primative.go +++ b/primative.go @@ -37,53 +37,53 @@ func NewString(value string) *Primative { return NewPrimative(STRING, value) } -func (this *Primative) GetType() ValueType { - return this.valueType +func (primative *Primative) GetType() ValueType { + return primative.valueType } -func (this *Primative) GetValue() interface{} { - return this.value +func (primative *Primative) GetValue() interface{} { + return primative.value } -func (this *Primative) UpdateValue(value interface{}) error { +func (primative *Primative) UpdateValue(value interface{}) error { // Valid types switch value.(type) { case bool: - this.valueType = BOOLEAN + primative.valueType = BOOLEAN case float64: - this.valueType = FLOAT + primative.valueType = FLOAT case int64: - this.valueType = INTEGER + primative.valueType = INTEGER case nil: - this.valueType = NULL + primative.valueType = NULL case string: - this.valueType = STRING + primative.valueType = STRING default: msg := fmt.Sprintf("Unsupported type, %s must be of (bool, float64, int64, nil, string)", value) return errors.New(msg) } - this.value = value + primative.value = value return nil } -func (this *Primative) AsBoolean() (bool, error) { - return asBoolean(this.value) +func (primative *Primative) AsBoolean() (bool, error) { + return asBoolean(primative.value) } -func (this *Primative) AsFloat() (float64, error) { - return asFloat(this.value) +func (primative *Primative) AsFloat() (float64, error) { + return asFloat(primative.value) } -func (this *Primative) AsInteger() (int64, error) { - return asInteger(this.value) +func (primative *Primative) AsInteger() (int64, error) { + return asInteger(primative.value) } -func (this *Primative) AsString() (string, error) { - return asString(this.value) +func (primative *Primative) AsString() (string, error) { + return asString(primative.value) } -func (this *Primative) String() string { - str, _ := this.AsString() +func (primative *Primative) String() string { + str, _ := primative.AsString() return str }