josephspurrier / gowebapp

Basic MVC Web Application in Go
MIT License
1.14k stars 197 forks source link

Sample CRUD #13

Closed k0fi closed 8 years ago

k0fi commented 8 years ago

Hello Joseph,

I'm having difficulty to add a crud to the MVC. That would be great if you could add a sample post crud example. Thanks

josephspurrier commented 8 years ago

Could you be more specific is what you are looking for? If you are using Mongo, you can look at this file to see an example of how to interact with the database for a Create and Read operation. https://github.com/josephspurrier/gowebapp/blob/master/model/mongo/user.go (This is file not actually used in the Controllers, but is there just for reference. The actual code that is referenced in the Controllers is this file (it's so you can easily swap out the database): https://github.com/josephspurrier/gowebapp/blob/master/model/user.go

The documentation for Remove is here: https://godoc.org/gopkg.in/mgo.v2#Collection.Remove The documentation for Update is here: https://godoc.org/gopkg.in/mgo.v2#Collection.Update

k0fi commented 8 years ago

Well, I know that the User model is a pretty good example but I'm a person who is very knew to go and learns by examples. At the moment the go docs looks mostly gibberish to me. What I need is a kind of simple blog app, upon which I can develop more sophisticated apps.

josephspurrier commented 8 years ago

Ah, I see what you are looking for. That would be a good thing to add to the app. I like the idea of a little notepad functionality to Create, Read, Update, and Delete notes. I won't be able to work on it until the first week in May though.

k0fi commented 8 years ago

Alright I appreciate if you can add a notepad sample app at your convenience.

ghost commented 8 years ago

+1 : I'd be really interested in seeing this as well 👍

The code is great by the way, learning a lot from it, thanks for sharing this, really appreciate it.

josephspurrier commented 8 years ago

The notepad functionality was added. Let me know if you have any issues!.

k0fi commented 8 years ago

Excellent! I tested with mongodb ans saw no issues so far. Many thanks for swift creation of the CRUD.

ghost commented 8 years ago

Hi,

I just tested with the default boltdb - it works - Brilliant example :-) Thanks very much, this is great.

Regards, John

josephspurrier commented 8 years ago

Wonderful! Thanks for the feedback guys!