Skip to content
This repository has been archived by the owner on Apr 19, 2019. It is now read-only.

Commit

Permalink
Added struct functions to make them simple to call
Browse files Browse the repository at this point in the history
  • Loading branch information
sionide21 committed Dec 27, 2009
1 parent df8e82c commit 73fa974
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions xmlrpc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ GOFILES=\
response.go\
http.go\
param.go\
struct.go\

include $(GOROOT)/src/Make.pkg
27 changes: 27 additions & 0 deletions xmlrpc/struct.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package xmlrpc

import (
"time"
)

func (st StructValue) GetInt(s string) int { return int(st[s].(IntValue)) }

func (st StructValue) GetString(s string) string {
return string(st[s].(StringValue))
}

func (st StructValue) GetDouble(s string) float {
return float(st[s].(DoubleValue))
}

func (st StructValue) GetTime(s string) time.Time {
return time.Time(st[s].(DateTimeValue))
}

func (st StructValue) GetBoolean(s string) bool {
return bool(st[s].(BooleanValue))
}

func (st StructValue) GetBytes(s string) []byte {
return []byte(st[s].(Base64Value))
}

0 comments on commit 73fa974

Please sign in to comment.