Working auth and photo json endpoint
Signed-off-by: Kris Nóva <kris@nivenly.com>
This commit is contained in:
parent
ef275f97f4
commit
e4323b6047
2032 changed files with 821464 additions and 52 deletions
40
vendor/github.com/leandro-lugaresi/hub/message.go
generated
vendored
Normal file
40
vendor/github.com/leandro-lugaresi/hub/message.go
generated
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
package hub
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type (
|
||||
// Fields is a [key]value storage for Messages values.
|
||||
Fields map[string]interface{}
|
||||
|
||||
// Message represent some message/event passed into the hub
|
||||
// It also contain some helper functions to convert the fields to primitive types.
|
||||
Message struct {
|
||||
Name string
|
||||
Body []byte
|
||||
Fields Fields
|
||||
}
|
||||
)
|
||||
|
||||
// Topic return the message topic used when the message was sended.
|
||||
func (m *Message) Topic() string {
|
||||
return m.Name
|
||||
}
|
||||
|
||||
func (f Fields) String() string {
|
||||
if len(f) == 0 {
|
||||
return "Fields(<empty>)"
|
||||
}
|
||||
|
||||
fields := make([]string, 0, len(f))
|
||||
for k, v := range f {
|
||||
fields = append(fields, fmt.Sprintf("[%s]%v", k, v))
|
||||
}
|
||||
|
||||
sort.Strings(fields)
|
||||
|
||||
return "Fields( " + strings.Join(fields, ", ") + " )"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue