This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// KTTime is an example of a type that is aliased to time, than implements the json marshaling functions. | |
// This is an example for how to build serialization interopability with kotlin/gson. | |
package kttime | |
type KTTime time.Time | |
func (t KTTime) MarshalJSON() ([]byte, error) { | |
gt := time.Time(t) | |
f := gt.Format(ktFormat) | |
return json.Marshal(f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"context" | |
"net/http" | |
) | |
type key int | |
var contextKey = key(22) | |
func SetUser(usr *User, r *http.Request) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Role int | |
const ( | |
RoleUnknown Role = iota | |
_ | |
_ | |
RoleUser | |
_ | |
_ | |
RoleAdmin |
OlderNewer