From e61eb254b52f20204de74cdb7096f8985abf3100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Nieto?= <jose.carlos@menteslibres.net> Date: Sun, 26 Jul 2015 12:43:39 -0500 Subject: [PATCH] Adding method comments. --- util/adapter/nonexistent.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/util/adapter/nonexistent.go b/util/adapter/nonexistent.go index 37587b51..2139ca75 100644 --- a/util/adapter/nonexistent.go +++ b/util/adapter/nonexistent.go @@ -39,22 +39,28 @@ func err(e error) error { return e } +// NonExistentCollection represents a collection that does not exist. type NonExistentCollection struct { Err error } +// NonExistentResult represents a result set that was based on a non existent +// collection and therefore does not exist. type NonExistentResult struct { Err error } +// Append returns error. func (c *NonExistentCollection) Append(interface{}) (interface{}, error) { return nil, err(c.Err) } +// Exists returns false. func (c *NonExistentCollection) Exists() bool { return false } +// Find returns a NonExistentResult. func (c *NonExistentCollection) Find(...interface{}) db.Result { if c.Err != nil { return &NonExistentResult{Err: c.Err} @@ -62,62 +68,77 @@ func (c *NonExistentCollection) Find(...interface{}) db.Result { return &NonExistentResult{Err: fmt.Errorf("Collection reported an error: %q", err(c.Err))} } +// Truncate returns error. func (c *NonExistentCollection) Truncate() error { return err(c.Err) } +// Name returns an empty string. func (c *NonExistentCollection) Name() string { return "" } +// Limit returns a NonExistentResult. func (r *NonExistentResult) Limit(uint) db.Result { return r } +// Skip returns a NonExistentResult. func (r *NonExistentResult) Skip(uint) db.Result { return r } +// Sort returns a NonExistentResult. func (r *NonExistentResult) Sort(...interface{}) db.Result { return r } +// Select returns a NonExistentResult. func (r *NonExistentResult) Select(...interface{}) db.Result { return r } +// Where returns a NonExistentResult. func (r *NonExistentResult) Where(...interface{}) db.Result { return r } +// Group returns a NonExistentResult. func (r *NonExistentResult) Group(...interface{}) db.Result { return r } +// Remove returns error. func (r *NonExistentResult) Remove() error { return err(r.Err) } +// Update returns error. func (r *NonExistentResult) Update(interface{}) error { return err(r.Err) } +// Count returns 0 and error. func (r *NonExistentResult) Count() (uint64, error) { return 0, err(r.Err) } +// Next returns error. func (r *NonExistentResult) Next(interface{}) error { return err(r.Err) } +// One returns error. func (r *NonExistentResult) One(interface{}) error { return err(r.Err) } +// All returns error. func (r *NonExistentResult) All(interface{}) error { return err(r.Err) } +// Close returns error. func (r *NonExistentResult) Close() error { return err(r.Err) } -- GitLab