3
0

Cleanup, comments improved

This commit is contained in:
Denis Arh
2018-10-07 08:28:46 +02:00
parent 377ecf8f0f
commit b07cbbbdd7
3 changed files with 8 additions and 36 deletions

View File

@@ -1,12 +1,9 @@
package payload
import (
"regexp"
"strconv"
)
var truthy = regexp.MustCompile("^\\s*(t(rue)?|y(es)?|1)\\s*$")
func Uint64toa(i uint64) string {
return strconv.FormatUint(i, 10)
}
@@ -20,17 +17,7 @@ func Uint64stoa(uu []uint64) []string {
return ss
}
//// parseInt64 parses an string to int64
//func parseInt64(s string) int64 {
// if s == "" {
// return 0
// }
// i, _ := strconv.ParseInt(s, 10, 64)
//
// return i
//}
//
// parseUInt64 parses an string to uint64
// ParseUInt64 parses an string to uint64
func ParseUInt64(s string) uint64 {
if s == "" {
return 0
@@ -38,18 +25,3 @@ func ParseUInt64(s string) uint64 {
i, _ := strconv.ParseUint(s, 10, 64)
return i
}
//// parseUInt64 parses an string to uint64
//func parseBool(s string) bool {
// return truthy.MatchString(strings.ToLower(s))
//}
//
//// is checks if string s is contained in matches
//func is(s string, matches ...string) bool {
// for _, v := range matches {
// if s == v {
// return true
// }
// }
// return false
//}

View File

@@ -40,9 +40,9 @@ type (
Delete(ID uint64) error
}
//channelSecurity interface {
// CanRead(ch *types.Channel) bool
//}
// channelSecurity interface {
// CanRead(ch *types.Channel) bool
// }
)
func Channel() ChannelService {
@@ -72,9 +72,9 @@ func (svc *channel) FindByID(id uint64) (ch *types.Channel, err error) {
return
}
//if !svc.sec.ch.CanRead(ch) {
// return nil, errors.New("Not allowed to access channel")
//}
// if !svc.sec.ch.CanRead(ch) {
// return nil, errors.New("Not allowed to access channel")
// }
return
}

View File

@@ -23,7 +23,7 @@ type (
}
)
// Sends sends events back to all subscribers
// Event sends sends events back to all (or specific) subscribers
func Event() EventService {
return (&event{events: repository.Events()}).With(context.Background())
}