Manually building Go objects from SQL results can be difficult to write and dangerous to modify. We'll use go-gorp to clean up our database calls.
- Hi, and welcome to section four,…"A Place for Everything."…During section three, we added functionality…for viewing libraries and deleting unwanted books…from our collection.…At the same time, we started utilizing…third party packages to write cleaner templates…and route handlers.…In section four, we're going to focus…on sorting and filtering our book collection…to help the user fulfill our initial goal…of putting together a bookshelf.…We'll start this section by integrating…the third party package "gorp" into our application…for cleaner database access.…Then, we'll introduce the functionality…to sort our book collection.…
Finally, we'll add the option to filter…our library by fiction or nonfiction.…In this video, we'll take advantage…of the third party package known as "gorp"…to make database calls a little easier.…We'll use gorp to extract the leading…and inserting rows into the database,…and bind go objects to database objects.…To start, we'll need to download the latest…stable gorp files.…Then, we'll need to set up the database mappings…
Go is on the rise. This open-source programming language (created by Google!) comes with a strong and accessible standard library, and provides a growing ecosystem of tools, libraries, and frameworks that can help you build web applications fast. Go for Web Development gets you started with the language, opening with the classic "Hello world" exercise and culminating in a web application with a strongly designed database back end, useful middleware, UI with an intelligent search function, multi-user authentication, and more.
First, learn how to build a web server with Go's extensive standard library. Explore the concepts behind a single-page web application and learn how to create a dynamic user interface, manipulate a database, and use powerful encryption algorithms to implement an authentication system. Next, you'll incorporate more functionality by calling out to external libraries from the database. Finally, it all comes together into an optimized package you can deploy into the wild with Heroku.
- Creating a route in Go
- Using templates
- Building database connections
- Collecting data
- Using web middleware
- Using the Ace template engine
- Integrating HTTP routers like gorilla/mux
- Authenticating users
- Optimizing a Go codebase