messages

package
v0.0.0-...-0120b79 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package messages creates or fetchs message data from Cassandra

Package messages creates or fetchs message data from Cassandra

Package messages creates or fetchs message data from Cassandra

Package messages creates or fetchs message data from Cassandra

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(w http.ResponseWriter, r *http.Request)

Get -- handles GET request to /messages/ to fetch all messages params: w - response writer for building JSON payload response r - request reader to fetch form data or url params (unused here)

func GetOne

func GetOne(w http.ResponseWriter, r *http.Request)

GetOne -- handles GET request to /messages/{message_uuid} to fetch one message params: w - response writer for building JSON payload response r - request reader to fetch form data or url params

func Post

func Post(w http.ResponseWriter, r *http.Request)

Post -- handles POST request to /messages/new to create a new message params: w - response writer for building JSON payload response r - request reader to fetch form data or url params

Types

type AllMessagesResponse

type AllMessagesResponse struct {
	Messages []Message `json:"messages"`
}

AllMessagesResponse struct for an array of Message structs

type ErrorResponse

type ErrorResponse struct {
	Errors []string `json:"errors"`
}

ErrorResponse for sending back a potential array of error strings

type GetMessageResponse

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

GetMessageResponse struct for embedding a single message

type Message

type Message struct {
	ID           gocql.UUID `json:"id"`
	UserID       gocql.UUID `json:"user_id"`
	UserFullName string     `json:"user_full_name"`
	Message      string     `json:"message"`
}

Message struct for preparing JSON payload

type NewMessageResponse

type NewMessageResponse struct {
	ID gocql.UUID `json:"id"`
}

NewMessageResponse struct for returning ID of message in payload

Jump to

Keyboard shortcuts

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