add Continent method to Village struct
This commit is contained in:
parent
deeeccf998
commit
fcd5cd5455
|
@ -1,5 +1,10 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type Village struct {
|
||||
tableName struct{} `pg:"?SERVER.villages,alias:village"`
|
||||
|
||||
|
@ -14,6 +19,13 @@ type Village struct {
|
|||
Player *Player `json:"player,omitempty" gqlgen:"-"`
|
||||
}
|
||||
|
||||
func (v *Village) Continent() string {
|
||||
if v == nil {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf("k%c%c", strconv.FormatInt(int64(v.Y), 10)[0], strconv.FormatInt(int64(v.y), 10)[0]))
|
||||
}
|
||||
|
||||
type VillageFilter struct {
|
||||
tableName struct{} `urlstruct:"village"`
|
||||
|
||||
|
|
Reference in New Issue