summaryrefslogtreecommitdiff
path: root/src/helsinki.at/rhimport/rddb.go
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2015-12-20 01:29:13 (GMT)
committerChristian Pointner <equinox@helsinki.at>2015-12-20 01:29:13 (GMT)
commit8fc2a9c93d566feae576c1421b3c64dabc4b4976 (patch)
tree2fcef9fdc3fa620d44989985b1878b807dbe456f /src/helsinki.at/rhimport/rddb.go
parent9f860e6f74791e103aed25a006dee55d7b3822b5 (diff)
improved type safety
Diffstat (limited to 'src/helsinki.at/rhimport/rddb.go')
-rw-r--r--src/helsinki.at/rhimport/rddb.go28
1 files changed, 23 insertions, 5 deletions
diff --git a/src/helsinki.at/rhimport/rddb.go b/src/helsinki.at/rhimport/rddb.go
index 25ef876..f596171 100644
--- a/src/helsinki.at/rhimport/rddb.go
+++ b/src/helsinki.at/rhimport/rddb.go
@@ -49,7 +49,7 @@ type getPasswordResult struct {
type getPasswordRequest struct {
username string
cached bool
- response chan getPasswordResult
+ response chan<- getPasswordResult
}
type getGroupOfCartResult struct {
@@ -59,7 +59,7 @@ type getGroupOfCartResult struct {
type getGroupOfCartRequest struct {
cart uint
- response chan getGroupOfCartResult
+ response chan<- getGroupOfCartResult
}
type getShowInfoResult struct {
@@ -73,7 +73,7 @@ type getShowInfoResult struct {
type getShowInfoRequest struct {
showid uint
- response chan getShowInfoResult
+ response chan<- getShowInfoResult
}
type checkMusicGroupResult struct {
@@ -83,7 +83,7 @@ type checkMusicGroupResult struct {
type checkMusicGroupRequest struct {
group string
- response chan checkMusicGroupResult
+ response chan<- checkMusicGroupResult
}
type getMusicInfoResult struct {
@@ -94,7 +94,15 @@ type getMusicInfoResult struct {
type getMusicInfoRequest struct {
group string
- response chan getMusicInfoResult
+ response chan<- getMusicInfoResult
+}
+
+type RdDbChan struct {
+ getPasswordChan chan<- getPasswordRequest
+ getGroupOfCartChan chan<- getGroupOfCartRequest
+ getShowInfoChan chan<- getShowInfoRequest
+ checkMusicGroupChan chan<- checkMusicGroupRequest
+ getMusicInfoChan chan<- getMusicInfoRequest
}
type RdDb struct {
@@ -289,6 +297,16 @@ func (self *RdDb) dispatchRequests() {
}
}
+func (self *RdDb) GetChannels() *RdDbChan {
+ ch := &RdDbChan{}
+ ch.getPasswordChan = self.getPasswordChan
+ ch.getGroupOfCartChan = self.getGroupOfCartChan
+ ch.getShowInfoChan = self.getShowInfoChan
+ ch.checkMusicGroupChan = self.checkMusicGroupChan
+ ch.getMusicInfoChan = self.getMusicInfoChan
+ return ch
+}
+
func (self *RdDb) Cleanup() {
self.quit <- true
<-self.done