Documentation ¶
Index ¶
- Constants
- func CreateTable(db *sql.DB) error
- func DeleteComment(db *sql.DB, id int) error
- func InitDB() (*sql.DB, error)
- func LogIn(db *sql.DB, username, password string) (bool, int)
- func SignUp(db *sql.DB, u User) (int, error)
- func VoteComment(db *sql.DB, comment_id, user_id int, up bool) error
- func WriteComment(db *sql.DB, c Comment) (int, error)
- type Comment
- type User
- type Vote
Constants ¶
View Source
const ( DB_USER = "mappyr" //"kpssujtcjeylzx" DB_PASSWORD = "mappass" //"By5bPQQibYr5KDkBu-E9nU5eaO" DB_NAME = "mappyr" //"dcnd0p0l81l0dr" DB_SSL = "disable" // "require" )
Variables ¶
This section is empty.
Functions ¶
func VoteComment ¶
UpVoteComment
Types ¶
type Comment ¶
type Comment struct { Id int `json:"id"` Title string `json:"title"` Description string `json:"description"` Lat float64 `json:"latitude"` Lon float64 `json:"longitude"` Upvotes int `json:"upvotes"` Downvotes int `json:"downvotes"` Date time.Time `json:"date"` UserId int `json:"user-id"` // 0 for anon User User `json:"user"` }
TODO: Add a place model? TODO: Description UPvote and Downvote
func ReadComment ¶
ReadComment reads a comment from the datase with an id.
func ReadComments ¶
ReadComments returns all comments TODO: Add the USER to the Comment Struct
func ReadLocalComments ¶
ReadLocalComments reads comments within ranges TODO: Add the USER to the Comment Struct
type User ¶
type Vote ¶
func CommentVotes ¶
CommentVotes returns a slice of Vote structs according to a passed in comment ID
Click to show internal directories.
Click to hide internal directories.