lifelog

package
Version: v0.0.0-...-f657b7d Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2016 License: GPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorNoMatch = errors.New("No Matching Record")
View Source
var PageSize = 10 // default page size

Functions

func HandleActivitiesGet

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

func HandleActivityDelete

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

func HandleActivityGet

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

func HandleActivityLogDelete

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

func HandleActivityLogGet

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

func HandleActivityLogPost

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

func HandleActivityLogPut

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

func HandleActivityLogsGet

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

func HandleActivityPost

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

func HandleActivityPut

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

func HandleGoalDelete

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

func HandleGoalGet

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

func HandleGoalPost

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

func HandleGoalPut

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

HandleGoalPut handles the PUT operation on the Goal entity type. Pass the goal string key in the URI And pass the json body with all the fields of goal struct. Pass all the fields. if a field is not changed, pass the unchanged value. Any missing fields will result in updating the database with the respective zero value, so Make sure you pass all the fields, even though the value is not changed.

func HandleGoalsGet

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

func Handlers

func Handlers() *mux.Router

func StringKey

func StringKey(s string) string

GetStringKey replaces the spaces in the given string with '-' inorder to prepare the string URL friendly

func WriteResponse

func WriteResponse(w http.ResponseWriter, statusCode int, contentType string, body interface{})

Types

type Activities

type Activities []Activity

TODO: need to add json tags for column names and to ignore blank fields

func (*Activities) Get

func (acts *Activities) Get(c context.Context, filter Activity, offset int, limit int) (err error)

type Activity

type Activity struct {
	ActivitySimple
	CommonSystemFields
}

TODO: need to add json tags for column names and to ignore blank fields

func (*Activity) Delete

func (act *Activity) Delete(c context.Context) (err error)

Delete

func (*Activity) Get

func (act *Activity) Get(c context.Context) (err error)

Get

func (*Activity) Put

func (act *Activity) Put(c context.Context) (err error)

Put (same for Post)

func (*Activity) SetDefaults

func (a *Activity) SetDefaults()

type ActivityLog

type ActivityLog struct {
	ActivityLogSimple
	CommonSystemFields
}

TODO: need to add json tags for column names and to ignore blank fields

func (*ActivityLog) Delete

func (al *ActivityLog) Delete(c context.Context) (err error)

Delete

func (*ActivityLog) Get

func (al *ActivityLog) Get(c context.Context) (err error)

Get

func (*ActivityLog) Put

func (al *ActivityLog) Put(c context.Context) error

Put (same for Post)

func (*ActivityLog) SetDefaults

func (a *ActivityLog) SetDefaults()

type ActivityLogSimple

type ActivityLogSimple struct {
	Name      string
	Notes     string `json:"Notes,omitempty"`
	StartTime time.Time
	EndTime   time.Time
}

TODO: need to add json tags for column names and to ignore blank fields

type ActivityLogSimpleNoTime

type ActivityLogSimpleNoTime struct {
	Name  string
	Notes string `json:"Notes,omitempty"`
}

TODO: need to add json tags for column names and to ignore blank fields

type ActivityLogs

type ActivityLogs []ActivityLog

TODO: need to add json tags for column names and to ignore blank fields

func (*ActivityLogs) Get

func (als *ActivityLogs) Get(c context.Context, filter ActivityLog, offset int, limit int) (err error)

type ActivitySimple

type ActivitySimple struct {
	Name   string
	GoalID string
}

TODO: need to add json tags for column names and to ignore blank fields

type CommonSystemFields

type CommonSystemFields struct {
	CreatedOn  time.Time
	ModifiedOn time.Time `json:"ModifiedOn,omitempty"`
}

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error"`
}

type Goal

type Goal struct {
	GoalSimple
	CommonSystemFields
}

func (*Goal) Delete

func (goal *Goal) Delete(c context.Context) (err error)

Delete deletes the record based on the provided key.

func (*Goal) Get

func (goal *Goal) Get(c context.Context) (err error)

Get retrieves the record based on the provided key.

func (*Goal) Put

func (goal *Goal) Put(c context.Context) error

Put saves the goal record to database. In this case to Google Appengine Datastore. If already exists, the record will be overwritten.

type GoalSimple

type GoalSimple struct {
	Name  string
	Notes string `json:"Notes,omitempty"`
}

type Goals

type Goals []Goal

func (*Goals) Get

func (goals *Goals) Get(c context.Context, filter Goal, offset int, limit int) (err error)

Get gets all the goal records matching the given criteria. Fields on which query supported are Name, Notes

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL