/** * TestSave */ func TestSave() { var doc = _document( "_id", "go_test_attc", "val1", "is val 1", "val2", "is val 2", "_attachments", []interface{}{ couch.NewDocumentAttachment(nil, "./attc.txt", "attc1"), couch.NewDocumentAttachment(nil, "./attc.txt", "attc2"), map[string]interface{}{"file": "./attc.txt", "fileName": "attc3"}, }, ) data, err := doc.Save(false, false) if err != nil { panic(err) } util.Dumpf("Document Save >> %v", data) util.Dumpf("Document Save >> ok: %v", data["ok"]) util.Dumpf("Document Save >> id: %v", data["id"]) util.Dumpf("Document Save >> rev: %v", data["rev"]) }
/** * 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 _documentAttachment(file, fileName string) *couch.DocumentAttachment { return couch.NewDocumentAttachment(Document, file, fileName) }