30 lines
621 B
Go
30 lines
621 B
Go
package dto
|
|
|
|
import (
|
|
"git.itzana.me/strafesnet/go-grpc/maps"
|
|
"time"
|
|
)
|
|
|
|
type Map struct {
|
|
ID int64 `json:"id"`
|
|
DisplayName string `json:"display_name"`
|
|
Creator string `json:"creator"`
|
|
GameID int32 `json:"game_id"`
|
|
Date time.Time `json:"date"`
|
|
} // @name Map
|
|
|
|
// FromGRPC converts a maps.MapResponse protobuf message to a Map domain object
|
|
func (m *Map) FromGRPC(resp *maps.MapResponse) *Map {
|
|
if resp == nil {
|
|
return nil
|
|
}
|
|
|
|
m.ID = resp.ID
|
|
m.DisplayName = resp.DisplayName
|
|
m.Creator = resp.Creator
|
|
m.Date = time.Unix(resp.Date, 0)
|
|
m.GameID = resp.GameID
|
|
|
|
return m
|
|
}
|