Documentation ¶
Overview ¶
Package reminders holds the application logic to manage reminders (tasks one seeks to remember).
Copyright 2015-2019 VMware, Inc. All Rights Reserved. Author: Tom Hite (thite@vmware.com)
SPDX-License-Identifier: https://spdx.org/licenses/MIT.html
This software is licensed to you under the MIT license (the "License"). You may not use this product except in compliance with the MIT License.
Package reminders holds the application logic to manage reminders (tasks one seeks to remember).
Copyright 2015-2019 VMware, Inc. All Rights Reserved. Author: Tim Green (greent@vmware.com)
SPDX-License-Identifier: https://spdx.org/licenses/MIT.html
Package reminders holds the application logic to manage reminders (tasks one seeks to remember).
Copyright 2015-2019 VMware, Inc. All Rights Reserved. Author: Tom Hite (thite@vmware.com)
SPDX-License-Identifier: https://spdx.org/licenses/MIT.html
Package reminders holds the application logic to manage reminders (tasks one seeks to remember).
Copyright 2015-2019 VMware, Inc. All Rights Reserved. Author: Tom Hite (thite@vmware.com)
SPDX-License-Identifier: https://spdx.org/licenses/MIT.html
Package reminders holds the application logic to manage reminders (tasks one seeks to remember).
Copyright 2015-2019 VMware, Inc. All Rights Reserved. Copyright (c) 2013-2015 Antoine Imbert Author: Tom Hite (thite@vmware.com)
SPDX-License-Identifier: https://spdx.org/licenses/MIT.html
Copyright 2015-2019 VMware, Inc. All Rights Reserved. Copyright (c) 2013-2015 Antoine Imbert Author: Tom Hite (thite@vmware.com)
SPDX-License-Identifier: https://spdx.org/licenses/MIT.html
Copyright 2015-2019 VMware, Inc. All Rights Reserved. Author: Tom Hite (thite@vmware.com)
SPDX-License-Identifier: https://spdx.org/licenses/MIT.html
Copyright 2015-2019 VMware, Inc. All Rights Reserved. Author: Tom Hite (thite@vmware.com)
SPDX-License-Identifier: https://spdx.org/licenses/MIT.html
Index ¶
- Constants
- type BasicAuth
- type Connection
- type DBCreds
- func (db *DBCreds) Address() string
- func (db *DBCreds) Admin() string
- func (db *DBCreds) CfgSrc() string
- func (db *DBCreds) DBType() string
- func (db *DBCreds) Extra() string
- func (db *DBCreds) FetchCredentials(insecure bool) error
- func (db *DBCreds) Init(host string, port int, admin string, passwd string, dbtype string, ...)
- func (db *DBCreds) Name() string
- func (db *DBCreds) Passwd() string
- func (db *DBCreds) Port() int
- func (db *DBCreds) SetAddress(host string)
- func (db *DBCreds) SetAdmin(admin string)
- func (db *DBCreds) SetCfgSrc(src string)
- func (db *DBCreds) SetDBType(t string)
- func (db *DBCreds) SetExtra(e string)
- func (db *DBCreds) SetName(name string)
- func (db *DBCreds) SetPasswd(passwd string)
- func (db *DBCreds) SetPort(port int)
- type MemDB
- func (db *MemDB) Close() error
- func (db *MemDB) DeleteGUID(guid string) (Reminder, error)
- func (db *MemDB) DeleteID(id int64) (Reminder, error)
- func (db *MemDB) Drop() error
- func (db *MemDB) GetAll() (*[]Reminder, error)
- func (db *MemDB) GetGUID(guid string) (Reminder, error)
- func (db *MemDB) GetID(id int64) (Reminder, error)
- func (db *MemDB) InitDB() error
- func (db *MemDB) Save(r Reminder) error
- type MySQLDB
- func (db *MySQLDB) Close() error
- func (db *MySQLDB) DeleteGUID(guid string) (Reminder, error)
- func (db *MySQLDB) DeleteID(id int64) (Reminder, error)
- func (db *MySQLDB) Drop() error
- func (db *MySQLDB) GetAll() (*[]Reminder, error)
- func (db *MySQLDB) GetGUID(guid string) (Reminder, error)
- func (db *MySQLDB) GetID(id int64) (Reminder, error)
- func (db *MySQLDB) InitDB() error
- func (db *MySQLDB) Save(r Reminder) error
- type Reminder
- type Reminders
- func (rem *Reminders) Delete(w rest.ResponseWriter, r *rest.Request)
- func (rem *Reminders) DeleteGuid(w rest.ResponseWriter, r *rest.Request)
- func (rem *Reminders) GetAll(w rest.ResponseWriter, r *rest.Request)
- func (rem *Reminders) GetGuid(w rest.ResponseWriter, r *rest.Request)
- func (rem *Reminders) GetId(w rest.ResponseWriter, r *rest.Request)
- func (rem *Reminders) Post(w rest.ResponseWriter, r *rest.Request)
- func (rem *Reminders) Put(w rest.ResponseWriter, r *rest.Request)
- func (rem *Reminders) PutGuid(w rest.ResponseWriter, r *rest.Request)
- type Storage
Constants ¶
const (
//MySQL is the name of the driver to use
MySQL = "mysql"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasicAuth ¶
type BasicAuth struct {
// contains filtered or unexported fields
}
func (*BasicAuth) GetDBCredsBasicAuth ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection holds the connection information to etcd
func NewEtcd ¶
func NewEtcd(host string) Connection
NewEtcd initializes a new instance of the Connection struct
func (*Connection) GetDBCreds ¶
func (conn *Connection) GetDBCreds(d *DBCreds) error
GetDBCreds gets the database credentials from etcd and stores them in the DBCreds struct
func (*Connection) SetDBCreds ¶
func (conn *Connection) SetDBCreds(d *DBCreds)
SetDBCreds stores database credentials from the DBCreds struct in Etcd
type DBCreds ¶
type DBCreds struct {
// contains filtered or unexported fields
}
DBCreds holds database credentials and connection information.
func (*DBCreds) FetchCredentials ¶
FetchCredentials obtains the database credentials from either Etcd or vRO if not provided on the command line [NOTE]: credentials should be pre-populated at config source.
func (*DBCreds) Init ¶
func (db *DBCreds) Init(host string, port int, admin string, passwd string, dbtype string, dbname string, cfgsrc string, extra string)
Init initializes the DBCreds struct.
func (*DBCreds) SetAddress ¶
SetAddress is a setter for the database host in the DBCreds struct.
func (*DBCreds) SetDBType ¶
SetDBType is a setter for the database type in the DBCreds struct. Acceptable values are "mem" or "mysql".
type MemDB ¶
type MemDB struct {
// contains filtered or unexported fields
}
MemDB emulates an in-memory database to store reminders.
func (*MemDB) DeleteGUID ¶
DeleteGUID removes the reminder with the given GUID from the database
func (*MemDB) GetGUID ¶
GetGUID returns the reminder stored in the database specified by the given GUID
type MySQLDB ¶
type MySQLDB struct {
// contains filtered or unexported fields
}
MySQLDB holds connection information and credentials for the MySQL database.
func (*MySQLDB) DeleteGUID ¶
DeleteGUID removes the reminder with the given GUID from the database.
func (*MySQLDB) GetGUID ¶
GetGUID returns the reminder with the given UUID. If not found, it will return a not found error.
func (*MySQLDB) GetID ¶
GetID returns the reminder with the given ID. If not found, it will return a not found error.
type Reminder ¶
type Reminder struct { ID int64 `json:"id"` GUID string `sql:"size:48;unique_index:idx_guid;size=32" json:"guid"` Message string `json:"message"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` DeletedAt time.Time `json:"-"` }
Reminder is serializable as json (tagged) and also SQL tags provide for best fit database storage (see the Go sql provider for details).
func ArrayFromJson ¶
Convert a JSON array of Reminders to Go slice and return.
type Reminders ¶
type Reminders struct {
// contains filtered or unexported fields
}
Reminders holds the Storage and Stats structs.
func NewReminders ¶
NewReminders initialize and returns a new Reminders struct.
func (*Reminders) Delete ¶
func (rem *Reminders) Delete(w rest.ResponseWriter, r *rest.Request)
Handle REST Delete request, which presumes Id as the identifying key.
func (*Reminders) DeleteGuid ¶
func (rem *Reminders) DeleteGuid(w rest.ResponseWriter, r *rest.Request)
Handle REST Delete request using Guid as the identifying key.
func (*Reminders) GetAll ¶
func (rem *Reminders) GetAll(w rest.ResponseWriter, r *rest.Request)
Retrieve all Reminders via REST Get request.
func (*Reminders) GetGuid ¶
func (rem *Reminders) GetGuid(w rest.ResponseWriter, r *rest.Request)
Retrieve one Reminder via REST Get request using guid as key.
func (*Reminders) GetId ¶
func (rem *Reminders) GetId(w rest.ResponseWriter, r *rest.Request)
Retrieve one Reminder via REST Get request using id as key.
func (*Reminders) Post ¶
func (rem *Reminders) Post(w rest.ResponseWriter, r *rest.Request)
Create a new Reminder (REST Post request). This also injects a guid.