Hello community,

here is the log from the commit of package golang-googlecode-couch-go for 
openSUSE:Factory checked in at 2015-07-24 09:58:35
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/golang-googlecode-couch-go (Old)
 and      /work/SRC/openSUSE:Factory/.golang-googlecode-couch-go.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "golang-googlecode-couch-go"

Changes:
--------
New Changes file:

--- /dev/null   2015-07-22 21:25:44.928025004 +0200
+++ 
/work/SRC/openSUSE:Factory/.golang-googlecode-couch-go.new/golang-googlecode-couch-go.changes
       2015-07-24 09:58:36.000000000 +0200
@@ -0,0 +1,51 @@
+-------------------------------------------------------------------
+Sun Jul 12 14:00:48 UTC 2015 - [email protected]
+
+- rename to golang-googlecode-couch-go
+- use golang-packaging for packaging
+
+-------------------------------------------------------------------
+Tue Sep 17 07:40:59 UTC 2013 - [email protected]
+
+- Only recommend couchdb to not depend on having it on the same
+  machine
+
+-------------------------------------------------------------------
+Tue Aug 13 11:45:25 UTC 2013 - [email protected]
+
+- Update to version 0.0.0+hg20120329.56.80177d89e264:
+  + Upstream provides no changelog
+- Use _service file
+- Drop rpmlintrc, both issues are obvious Go issues
+
+-------------------------------------------------------------------
+Tue Aug 13 07:59:11 UTC 2013 - [email protected]
+
+- Use %{go_exclusivearch} macro
+
+-------------------------------------------------------------------
+Sat Jun 29 10:52:05 UTC 2013 - [email protected]
+
+- Update package to latest mercurial
+
+-------------------------------------------------------------------
+Fri Oct  7 10:23:09 UTC 2011 - [email protected]
+
+- update API to Go r60 (via patch, changes submitted upstream)
+
+-------------------------------------------------------------------
+Wed Jun  8 15:14:17 UTC 2011 - [email protected]
+
+- Use new %go_disable_brp_strip_static_archive macro
+
+-------------------------------------------------------------------
+Sun May 22 10:31:34 UTC 2011 - [email protected]
+
+- Require couchdb
+- Disable tests, they need a running CouchDB
+
+-------------------------------------------------------------------
+Sat May 21 14:36:27 UTC 2011 - [email protected]
+
+- Initial version
+

New:
----
  README.SUSE
  _service
  couch-go-0.0.0+hg20120329.56.80177d89e264.tar.xz
  golang-googlecode-couch-go.changes
  golang-googlecode-couch-go.spec

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ golang-googlecode-couch-go.spec ++++++
#
# spec file for package golang-googlecode-couch-go
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2011 Sascha Peilicke <[email protected]>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           golang-googlecode-couch-go
Version:        0.0.0+hg20120329.56.80177d89e264
Release:        0
Summary:        Simple CouchDB API for Google Go
License:        MIT
Group:          Development/Languages/Other
Url:            http://code.google.com/p/couch-go/
Source:         couch-go-%{version}.tar.xz
Source1:        README.SUSE
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  golang-packaging
BuildRequires:  xz
%if 0%{?suse_version} >= 1100
Recommends:     couchdb
%endif
Provides:       go-couch-go = %{version}-%{release}
Obsoletes:      go-couch-go < %{version}-%{release}
%{go_provides}

%description
Couch-go is a simple CouchDB (0.9+) API for the Google Go language. It
supports basic operations on documents.

%gosrc_package

%prep
%setup -q -n couch-go-%{version}

%build
%goprep code.google.com/p/couch-go
%gobuild

%install
%goinstall
%gosrc

%files
%defattr(-,root,root,-)
%doc LICENSE
%{go_contribdir}/*

%files source
%defattr(-,root,root,-)
%{go_contribsrcdir}/*

%changelog
++++++ README.SUSE ++++++
Basic usage

First, create a Database object to represent the DB you'll be interacting with

db, err := couch.NewDatabase("127.0.0.1", "5984", "databasename")

A CouchDB document is represented by a Go struct

type Record struct {
    Type     string
    Count    uint64
    Elements []string
    MyMap    map[string]string
}

You can Insert these documents directly

r := Record{...}
id, rev, err := db.Insert(r)

and Retrieve them by ID.

r := new(Record)
rev, err := db.Retrieve(id, r)

If you want to specify document IDs, rather than have them auto-generated, you 
can use the InsertWith function

r := Record{...}
_, rev, err := db.InsertWith(r, "record_001")

or embed the _id in your document structure

type CompleteRecord struct {
    Id string "_id"
    Rev string "_rev" // useful only for Retrieve and Edit
    Foo string
    Count uint64
}
r := CompleteRecord{Id:"id001", Rev:"", Foo:"abc", Count:0}
_, rev, err := db.Insert(r)

You can also Edit a document, either by manually specifying the id and current 
revision

r := new(Record)
current_rev, err := db.Retrieve(some_id, r)
r.Count = r.Count + 1
current_rev, err = db.EditWith(r, some_id, current_rev)
if err != nil {
    // edit failed, out of sync?
}

or, as with Insert, by embedding _id and _rev fields in the document structure

complete_r = new(CompleteRecord) // has Id and Rev
current_rev, err := db.Retrieve(some_id, complete_r)
complete_r.Count = complete_r.Count + 1
current_rev, err = db.Edit(complete_r)
if err != nil {
    // edit failed, out of sync?
}

Delete works as expected

if err := db.Delete(id, current_rev); err != nil {
    // delete failed, out of sync?
}

You can also perform simple queries on views

func (p Database) Query(view string, options map[string]interface{}) ([]string, 
os.Error)

Check the source for more details.
Gotchas

couch-go uses the reflect package (by way of the json package) to read and 
write documents via the CouchDB API. reflect requires that struct fields are 
public (ie. begin with a capital letter) to read from and write to them. So, 
your document structures in Go must contain capitalized field names.

The behavior of the Insert and Edit classes of functions depend on the contents 
of the struct you pass to them 
++++++ _service ++++++
<services>
  <service name="tar_scm" mode="localonly">
    <param name="url">https://code.google.com/p/couch-go/</param>
    <param name="scm">hg</param>
    <param name="exclude">.hg</param>
    <param 
name="versionformat">0.0.0+hg{date|shortdate}.{rev}.{node|short}</param>
    <param name="revision">tip</param>
  </service>
  <service name="recompress" mode="localonly">
    <param name="file">couch-go-*.tar</param>
    <param name="compression">xz</param>
  </service>
  <service name="set_version" mode="localonly">
    <param name="basename">couch-go</param>
  </service>
</services>

Reply via email to