Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
DB *sqlx.DB
)
Functions ¶
func AddMemory ¶
AddMemory inserts memory. The sequence ID generated by the database is set on memory.
func GetSlugCount ¶
GetSlugCount returns the number of times the given slug appears in the memory table.
func NamedInsert ¶
NamedInsert executes the query insert statement and returns the generated sequence id.
func UpdateDetails ¶
UpdateDetails updates the details and update date for the given memory.
Types ¶
type Memory ¶
type Memory struct {
ID uint64 `db:"id" form:"id"`
AddressText string `db:"address_text" form:"address_text"`
Title string `db:"title" form:"title"`
Slug string `db:"slug"`
Details string `db:"details" form:"details"`
Latitude float64 `db:"latitude" form:"latitude"`
Longitude float64 `db:"longitude" form:"longitude"`
Author string `db:"author" form:"author"`
IsApproved bool `db:"is_approved"`
ApprovalUUID string `db:"approval_uuid"`
EditUUID string `db:"edit_uuid"`
InsertedAt time.Time `db:"inserted_at"`
UpdatedAt time.Time `db:"updated_at"`
}
A Memory represents a single memory that is tied to a location.
func GetAllMemories ¶
GetAllMemories returns all approved memories.
func GetMemory ¶
GetMemory returns an individual memory by slug. The memory will not be returned if it has not been approved.
func GetMemoryByApprovalUUID ¶
GetMemoryByApprovalUUID returns an indiviual memory by its approval UUID. The memory must not already be approved.
func GetMemoryByEditUUID ¶
GetMemoryByEditUUID returns an individual memory by its edit UUID. The memory will not be returned if it is not approved.
func GetRecentMemories ¶
GetRecentMemories returns the 5 most recent memories that are approved.