/** * TestRemove */ func TestRemove() { var doc = couch.NewDocument(Database, "_id", "attc_test", "_rev", "16-744735fac2c0bc49ff17f6a8fb8145bf", ) var docAttc = couch.NewDocumentAttachment(doc, "./attc.txt", "attc2.txt") data, err := docAttc.Remove(false, false) if err != nil { panic(err) } util.Dumpf("Document Attachment Remove >> %v", data) util.Dumpf("Document Attachment Remove >> ok: %v", data["ok"]) util.Dumpf("Document Attachment Remove >> id: %s", data["id"]) util.Dumpf("Document Attachment Remove >> rev: %s", data["rev"]) }
/** * TestSave */ func TestSave() { var doc = couch.NewDocument(Database, "_id", "attc_test", "_rev", "15-521ec44a6b39f3c5b40b20f94408dd57", ) var docAttc = couch.NewDocumentAttachment(doc, "./attc.txt", "attc2.txt") data, err := docAttc.Save() if err != nil { panic(err) } util.Dumpf("Document Attachment Save >> %v", data) util.Dumpf("Document Attachment Save >> ok: %v", data["ok"]) util.Dumpf("Document Attachment Save >> id: %s", data["id"]) util.Dumpf("Document Attachment Save >> rev: %s", data["rev"]) }
func init() { Couch = couch.New(nil, DEBUG) Client = couch.NewClient(Couch) Database = couch.NewDatabase(Client, DBNAME) Document = couch.NewDocument(Database, "_id", DOCID) }
func _document(data ...interface{}) *couch.Document { return couch.NewDocument(Database, data...) }