Documentation ¶
Index ¶
Constants ¶
const (
LatLongMultiplier = 1000000
)
Variables ¶
This section is empty.
Functions ¶
func SanitizeString ¶
SanitizeString removes all non-alphanumeric characters from a string, except for commas, dots, minus signs, and underscores.
func WithinCircumference ¶
WithinCircumference calculates if two Location points are within the same geographic circumference of diameter equal to the specified distance. The function takes in three arguments: - location1: a Location struct with latitude and longitude in microdegrees (1e-6 degrees) - location2: a Location struct with latitude and longitude in microdegrees (1e-6 degrees) - distance: an integer representing the diameter of the circumference in meters The function returns a boolean value indicating whether the two Location points are within the same circumference of diameter equal to the distance.
Types ¶
type Database ¶
func (*Database) CreateTables ¶
type HexBytes ¶
type HexBytes []byte
HexBytes is a []byte which encodes as hexadecimal in json, as opposed to the base64 default.
func (HexBytes) MarshalJSON ¶
func (*HexBytes) UnmarshalJSON ¶
type Image ¶
type Image struct { Hash []byte `json:"hash"` Name string `json:"name"` Content []byte `json:"content"` Link string `json:"link"` }
Image is a type that represents an image.
type Location ¶
Location is a type that represents a location, with latitude and longitude in microdegrees.
func NewLocation ¶
NewLocation creates a new location that is a certain distance (in kilometers) north and east from a starting location. The distance is approximated using a simple flat Earth model, which is reasonably accurate for small distances (up to a few hundred kilometers).
type Tool ¶
type Tool struct { ID int64 `json:"id"` Title string `json:"title"` Description string `json:"description"` IsAvailable bool `json:"isAvailable" genji:"isAvailable"` MayBeFree bool `json:"mayBeFree" genji:"mayBeFree"` AskWithFee bool `json:"askWithFee" genji:"askWithFee"` Cost uint64 `json:"cost"` UserID string `json:"userId" genji:"userId"` Images []Image `json:"images"` TransportOptions []Transport `json:"transportOptions" genji:"transportOptions"` ToolCategory int `json:"toolCategory" genji:"toolCategory"` Location Location `json:"location"` Rating int32 `json:"rating"` EstimatedValue uint64 `json:"estimatedValue" genji:"estimatedValue"` Height uint32 `json:"height"` Weight uint32 `json:"weight"` ReservedDates []DateRange `json:"reservedDates" genji:"reservedDates"` }
Tool is a tool that can be borrowed by a user.
type ToolCategory ¶
ToolCategory contains the categories for the tools. The ID zero is reserved for non existing category.
type User ¶
type User struct { Email string `json:"email"` Name string `json:"name"` Community string `json:"community"` Password []byte `json:"-"` Tokens uint64 `json:"tokens"` Active bool `json:"active"` Rating int32 `json:"rating"` AvatarHash HexBytes `json:"avatarHash" genji:"avatarHash"` // hash of the image Location Location `json:"location"` Verified bool `json:"-"` }
User is a type that represents a user of the app.