handler

package
v0.0.0-...-005d3ff Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Likek    ckey = "like"
	Dislikek ckey = "dislike"
	Fromk    ckey = "from"
)

Variables

This section is empty.

Functions

func AddFriend

func AddFriend(id string, friend string)

func GetCollection

func GetCollection(id string) map[ckey]map[string]int

func GetFriends

func GetFriends(id string) []string

func GetRecord

func GetRecord(id string) map[string]int

func GetUserInfo

func GetUserInfo() echo.HandlerFunc

func IncrementCollection

func IncrementCollection(id string, key ckey, passedID string)

func IncrementCollections

func IncrementCollections(id string, passedID string)

func IncrementRecord

func IncrementRecord(id string)

func Ping

func Ping(rdb *redis.Client) echo.HandlerFunc

func SetUserInfo

func SetUserInfo() echo.HandlerFunc

func SetUserPos

func SetUserPos(rad float64, rdb *redis.Client) echo.HandlerFunc

reqでid,lat,lonが来る resですれ違い人数(cnt),すれ違った人のid,lat,lonを配列で返す "cnt": 2, "users": [

{
  "id": "user1",
  "lat": 35.123456,
  "lon": 135.123456
},
...

] すれ違い人数が0の場合は "cnt": 0, "users": [] を返す すれ違ったユーザーの名前をFriendに追加する 一度すれ違ったユーザーはFriendに追加しないかつ、すれ違い人数にも含まない

Types

type Message

type Message struct {
	Message string `json:"message"`
}

type Position

type Position struct {
	ID  string  `json:"id"`
	Lat float64 `json:"lat"`
	Lon float64 `json:"lon"`
}

type ReqUserInfo

type ReqUserInfo struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Like    string `json:"like"`
	Dislike string `json:"dislike"`
	From    string `json:"from"`
}

type ResPos

type ResPos struct {
	Cnt   int        `json:"cnt"`
	Users []Position `json:"users"`
}

type UserInfo

type UserInfo struct {
	ReqUserInfo
	Friends    []string                `json:"friends"`
	Collection map[ckey]map[string]int `json:"collection"`
	Record     map[string]int          `json:"record"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL