diff --git a/backend/connector_couchdb.exe b/backend/connector_couchdb.exe index 9f60afb..5919d6b 100644 Binary files a/backend/connector_couchdb.exe and b/backend/connector_couchdb.exe differ diff --git a/backend/connector_couchdb.go b/backend/connector_couchdb.go index 0d946b4..8dfcb17 100644 --- a/backend/connector_couchdb.go +++ b/backend/connector_couchdb.go @@ -76,6 +76,12 @@ func addNewCard(_isQuestion bool, _blank int, _text string) { // fmt.Printf(result) fmt.Println(reflect.TypeOf(result)) + // get id and current revision. + if err := db.Get(doc, result.ID); err != nil { + panic(err) + } + + fmt.Printf(result.ID) } func main() { diff --git a/backend/models.go b/backend/models.go index b6b0bbb..1008953 100644 --- a/backend/models.go +++ b/backend/models.go @@ -1,5 +1,7 @@ package main +import "github.com/zemirco/couchdb" + //struktura użytkownika /* CREATE TABLE users ( @@ -23,10 +25,10 @@ type User struct { // Structura karty /* */ -// type Card struct { -// couchdb.Document -// id int `json:"id" binding:"required"` -// isQuestion bool `json:"typ"` //0 karta pytanie, 1 karta odpowiedź -// blank int `json:"puste" binding:"required"` //ile kart odpowiedzi na pytanie -// text string `json:"tekst" binding:"required"` // podłoga to luka -// } +type Card struct { + couchdb.Document + id int `json:"id" binding:"required"` + isQuestion bool `json:"typ"` //0 karta pytanie, 1 karta odpowiedź + blank int `json:"puste" binding:"required"` //ile kart odpowiedzi na pytanie + text string `json:"tekst" binding:"required"` // podłoga to luka +}