Press "Enter" to skip to content

Web Apps with Go & Postgres


this video is brought to you by Greater

this video is brought to you by Greater Commons greater learning greater

Commons greater learning greater

Commons greater learning greater opportunities greater life visit us at

opportunities greater life visit us at

opportunities greater life visit us at Greater Commons comm so I want to show

Greater Commons comm so I want to show

Greater Commons comm so I want to show you how to do a basic web app using the

you how to do a basic web app using the

you how to do a basic web app using the go programming language and I’m just

go programming language and I’m just

go programming language and I’m just going to introduce you to the resources

going to introduce you to the resources

going to introduce you to the resources and give you all the code that you need

and give you all the code that you need

and give you all the code that you need and get you up and running and you’ll be

and get you up and running and you’ll be

and get you up and running and you’ll be able to do create read update delete and

able to do create read update delete and

able to do create read update delete and you’ll be able to use Postgres to do it

you’ll be able to use Postgres to do it

you’ll be able to use Postgres to do it and and it will all be with the go

and and it will all be with the go

and and it will all be with the go programming language but I want you to

programming language but I want you to

programming language but I want you to like this video and I want you to

like this video and I want you to

like this video and I want you to retweet this video and I want you to

retweet this video and I want you to

retweet this video and I want you to share it on social networks because here

share it on social networks because here

share it on social networks because here on YouTube these are the videos in my

on YouTube these are the videos in my

on YouTube these are the videos in my channel and in this video here build web

channel and in this video here build web

channel and in this video here build web apps go language 135,000 people have

apps go language 135,000 people have

apps go language 135,000 people have watched it and that’s an OK video but I

watched it and that’s an OK video but I

watched it and that’s an OK video but I made that like a year ago and so I

made that like a year ago and so I

made that like a year ago and so I really need this video here to be what

really need this video here to be what

really need this video here to be what people are watching because this video

people are watching because this video

people are watching because this video and the material I have to share with

and the material I have to share with

and the material I have to share with you is way way better and I’ve been

you is way way better and I’ve been

you is way way better and I’ve been teaching go and web dev would go at the

teaching go and web dev would go at the

teaching go and web dev would go at the University and the college level for a

University and the college level for a

University and the college level for a couple years now and I’ve worked with

couple years now and I’ve worked with

couple years now and I’ve worked with Caleb doxy and Bill Kennedy right just

Caleb doxy and Bill Kennedy right just

Caleb doxy and Bill Kennedy right just to get the go code perfect and here’s

to get the go code perfect and here’s

to get the go code perfect and here’s the code base you know the resource

the code base you know the resource

the code base you know the resource here’s here’s the code pathway for

here’s here’s the code pathway for

here’s here’s the code pathway for learning go web dev and this is the best

learning go web dev and this is the best

learning go web dev and this is the best code pathway in the entire world

code pathway in the entire world

code pathway in the entire world and I know because this is what I do

and I know because this is what I do

and I know because this is what I do full time I study go I study go web dev

full time I study go I study go web dev

full time I study go I study go web dev and I teach it at the college of the

and I teach it at the college of the

and I teach it at the college of the University and I’ve worked with you know

University and I’ve worked with you know

University and I’ve worked with you know Caleb dachsie like created the

Caleb dachsie like created the

Caleb dachsie like created the foundation of this code base and we’ve

foundation of this code base and we’ve

foundation of this code base and we’ve built upon it so it’s an amazing code

built upon it so it’s an amazing code

built upon it so it’s an amazing code base it’s the best code base in the

base it’s the best code base in the

base it’s the best code base in the entire world screaming web dev let’s go

entire world screaming web dev let’s go

entire world screaming web dev let’s go so just discovering this like just tweet

so just discovering this like just tweet

so just discovering this like just tweet this video so people can discover this

this video so people can discover this

this video so people can discover this because I want people to get into the

because I want people to get into the

because I want people to get into the gogo language I love it and I want to I

gogo language I love it and I want to I

gogo language I love it and I want to I want to spread the gospel of go and and

want to spread the gospel of go and and

want to spread the gospel of go and and so people have a good way to learn it

so people have a good way to learn it

so people have a good way to learn it and get into it they’ll be more likely

and get into it they’ll be more likely

and get into it they’ll be more likely to use it I’m not paid by Google either

to use it I’m not paid by Google either

to use it I’m not paid by Google either by the way

by the way

by the way so down here is Postgres we’re going to

so down here is Postgres we’re going to

so down here is Postgres we’re going to like do this post grass and look at this

like do this post grass and look at this

like do this post grass and look at this code that’s when we’re going to look at

code that’s when we’re going to look at

code that’s when we’re going to look at but in post grass and you can go install

but in post grass and you can go install

but in post grass and you can go install post grass and Postgres website alright

post grass and Postgres website alright

post grass and Postgres website alright I’ve lost my voice I just got to talk

I’ve lost my voice I just got to talk

I’ve lost my voice I just got to talk quiet I guess but down here you hit

quiet I guess but down here you hit

quiet I guess but down here you hit download and if you’re on a Mac you just

download and if you’re on a Mac you just

download and if you’re on a Mac you just want to get this one right here that’s

want to get this one right here that’s

want to get this one right here that’s light and that’s easy and if you’re on a

light and that’s easy and if you’re on a

light and that’s easy and if you’re on a Windows you could you can watch my

Windows you could you can watch my

Windows you could you can watch my training where I show you how to do all

training where I show you how to do all

training where I show you how to do all this my training you can find it for

this my training you can find it for

this my training you can find it for migrator comments comm look there first

migrator comments comm look there first

migrator comments comm look there first we’re building a site all and go and

we’re building a site all and go and

we’re building a site all and go and it’s a place where you’ll be able to

it’s a place where you’ll be able to

it’s a place where you’ll be able to teach and and and you know deliver

teach and and and you know deliver

teach and and and you know deliver educational content very economically to

educational content very economically to

educational content very economically to help people learn for the greater good

help people learn for the greater good

help people learn for the greater good of humanity greater Commons so if it’s

of humanity greater Commons so if it’s

of humanity greater Commons so if it’s not if it hasn’t launched yet the course

not if it hasn’t launched yet the course

not if it hasn’t launched yet the course will be up there when this launches

will be up there when this launches

will be up there when this launches right now you can also find the course

right now you can also find the course

right now you can also find the course on Todd MacLeod view to me so just go

on Todd MacLeod view to me so just go

on Todd MacLeod view to me so just go google that and you’ll get to the course

google that and you’ll get to the course

google that and you’ll get to the course go web dev and that shows you how to do

go web dev and that shows you how to do

go web dev and that shows you how to do it on Windows Postgres and everything

it on Windows Postgres and everything

it on Windows Postgres and everything all right so let’s see it so you get

all right so let’s see it so you get

all right so let’s see it so you get Postgres installed and then you want to

Postgres installed and then you want to

Postgres installed and then you want to create a database a book store so you

create a database a book store so you

create a database a book store so you can see there i have a database

can see there i have a database

can see there i have a database bookstore that’s right there that’s my

bookstore that’s right there that’s my

bookstore that’s right there that’s my database if we go go into in the

database if we go go into in the

database if we go go into in the bookstore and then take a look at you

bookstore and then take a look at you

bookstore and then take a look at you know it’s got one table books so we can

know it’s got one table books so we can

know it’s got one table books so we can select everything from books right and

select everything from books right and

select everything from books right and there what did I mess up select star

there what did I mess up select star

there what did I mess up select star from books select let’s just try it

from books select let’s just try it

from books select let’s just try it again

again

again sometimes my terminal does that see same

sometimes my terminal does that see same

sometimes my terminal does that see same command and in there out so there are my

command and in there out so there are my

command and in there out so there are my three records I got three records in

three records I got three records in

three records I got three records in there let’s look at the code and yeah

there let’s look at the code and yeah

there let’s look at the code and yeah it’s working on us on a map Mac I just

it’s working on us on a map Mac I just

it’s working on us on a map Mac I just wander if I to pull it but here here we

wander if I to pull it but here here we

wander if I to pull it but here here we have the code and this is the exact same

have the code and this is the exact same

have the code and this is the exact same code which is right here right exact

code which is right here right exact

code which is right here right exact same code it’s probably I can note but

same code it’s probably I can note but

same code it’s probably I can note but I’m in that so you have access to this

I’m in that so you have access to this

I’m in that so you have access to this code did I already show you the URL

code did I already show you the URL

code did I already show you the URL there’s the URL

there’s the URL

there’s the URL so you go into this code and then here

so you go into this code and then here

so you go into this code and then here all the steps to build it up and this is

all the steps to build it up and this is

all the steps to build it up and this is like you know an hour to of training

like you know an hour to of training

like you know an hour to of training right there so I’m not going to go

right there so I’m not going to go

right there so I’m not going to go through all of it but this is the

through all of it but this is the

through all of it but this is the finished deal let’s just watch it run

finished deal let’s just watch it run

finished deal let’s just watch it run and then I’ll show you the code walk you

and then I’ll show you the code walk you

and then I’ll show you the code walk you through the code so I’m going to switch

through the code so I’m going to switch

through the code so I’m going to switch into that over here on this side I’m

into that over here on this side I’m

into that over here on this side I’m already there yeah I’m in 44:22 so I’m

already there yeah I’m in 44:22 so I’m

already there yeah I’m in 44:22 so I’m going to run that and we’ll come over

going to run that and we’ll come over

going to run that and we’ll come over and take a look at it and so yeah there

and take a look at it and so yeah there

and take a look at it and so yeah there are those three records we saw and I

are those three records we saw and I

are those three records we saw and I could insert a book but I don’t want to

could insert a book but I don’t want to

could insert a book but I don’t want to have to think of an ISBN number and so I

have to think of an ISBN number and so I

have to think of an ISBN number and so I don’t know what’s the title of a book

don’t know what’s the title of a book

don’t know what’s the title of a book West with night a Beryl Markham if you

West with night a Beryl Markham if you

West with night a Beryl Markham if you have not read this book I will not be

have not read this book I will not be

have not read this book I will not be steering you wrong go get this book this

steering you wrong go get this book this

steering you wrong go get this book this book is like one of the best books I’ve

book is like one of the best books I’ve

book is like one of the best books I’ve ever read in my life it’s so great I

ever read in my life it’s so great I

ever read in my life it’s so great I created that book showed the record go

created that book showed the record go

created that book showed the record go back to all books it’s in there I can

back to all books it’s in there I can

back to all books it’s in there I can update it if I want

update it if I want

update it if I want that’s like I’m a blues singer or some

that’s like I’m a blues singer or some

that’s like I’m a blues singer or some so change numbers out of the West with

so change numbers out of the West with

so change numbers out of the West with the night Beryl Markham let’s say we’re

the night Beryl Markham let’s say we’re

the night Beryl Markham let’s say we’re making it on sale so now it’s 1499 go

making it on sale so now it’s 1499 go

making it on sale so now it’s 1499 go back to all books and Emma Jane Austen

back to all books and Emma Jane Austen

back to all books and Emma Jane Austen who wanted to read that delete that we

who wanted to read that delete that we

who wanted to read that delete that we got crud created read update delete and

got crud created read update delete and

got crud created read update delete and it’s all restful right we go look at a

it’s all restful right we go look at a

it’s all restful right we go look at a book books show nice URLs drop the drop

book books show nice URLs drop the drop

book books show nice URLs drop the drop to you know some value in there URL

to you know some value in there URL

to you know some value in there URL parameters so look at that code right

parameters so look at that code right

parameters so look at that code right here you know I could go into this in

here you know I could go into this in

here you know I could go into this in quite a bit of depth so I was the first

quite a bit of depth so I was the first

quite a bit of depth so I was the first place to start if you don’t know any go

place to start if you don’t know any go

place to start if you don’t know any go web dev it’s a really it’s a kind of an

web dev it’s a really it’s a kind of an

web dev it’s a really it’s a kind of an entire process so I

entire process so I

entire process so I think I’m just going to keep this video

think I’m just going to keep this video

think I’m just going to keep this video short because this would be about 40

short because this would be about 40

short because this would be about 40 minutes for me to walk you through all

minutes for me to walk you through all

minutes for me to walk you through all this but I think that this is the best

this but I think that this is the best

this but I think that this is the best example this code for learning how to do

example this code for learning how to do

example this code for learning how to do go web dev I kind of want to go into it

go web dev I kind of want to go into it

go web dev I kind of want to go into it I kind of feel you say man go into it

I kind of feel you say man go into it

I kind of feel you say man go into it let’s go into it so if you don’t if if

let’s go into it so if you don’t if if

let’s go into it so if you don’t if if this doesn’t make sense to you I’ve got

this doesn’t make sense to you I’ve got

this doesn’t make sense to you I’ve got an introduction to the go programming

an introduction to the go programming

an introduction to the go programming language and I’m just giving me the

language and I’m just giving me the

language and I’m just giving me the resources and I’m not trying to sell you

resources and I’m not trying to sell you

resources and I’m not trying to sell you something I mean obviously this is also

something I mean obviously this is also

something I mean obviously this is also how help support my family got two kids

how help support my family got two kids

how help support my family got two kids and but if you don’t have the resources

and but if you don’t have the resources

and but if you don’t have the resources the money the course is usually like ten

the money the course is usually like ten

the money the course is usually like ten or fifteen dollars if you don’t have the

or fifteen dollars if you don’t have the

or fifteen dollars if you don’t have the money to pay for that just send me an

money to pay for that just send me an

money to pay for that just send me an email on Twitter message me on Twitter

email on Twitter message me on Twitter

email on Twitter message me on Twitter and here’s my Twitter deal and at Todd

and here’s my Twitter deal and at Todd

and here’s my Twitter deal and at Todd McCloud I guess the shade URL that’s

McCloud I guess the shade URL that’s

McCloud I guess the shade URL that’s better send me a message on Twitter and

better send me a message on Twitter and

better send me a message on Twitter and just interesting god I totally want to

just interesting god I totally want to

just interesting god I totally want to take course but I’m college to it in our

take course but I’m college to it in our

take course but I’m college to it in our live in India or you know I don’t have

live in India or you know I don’t have

live in India or you know I don’t have that money whatever I don’t care what

that money whatever I don’t care what

that money whatever I don’t care what your reason is you don’t have the money

your reason is you don’t have the money

your reason is you don’t have the money that’s fine I’ll give you free access I

that’s fine I’ll give you free access I

that’s fine I’ll give you free access I want you to learn it for the good of all

want you to learn it for the good of all

want you to learn it for the good of all for the greater good the greater cons

for the greater good the greater cons

for the greater good the greater cons that’s why we’re building that site so

that’s why we’re building that site so

that’s why we’re building that site so just send me a message and I’ll give you

just send me a message and I’ll give you

just send me a message and I’ll give you free access but I have an introduction

free access but I have an introduction

free access but I have an introduction of a go programming language to teach

of a go programming language to teach

of a go programming language to teach you everything all right so really go

you everything all right so really go

you everything all right so really go look at the net HTTP package so if this

look at the net HTTP package so if this

look at the net HTTP package so if this doesn’t make sense

doesn’t make sense

doesn’t make sense take that introduction course and here

take that introduction course and here

take that introduction course and here in the net HT package we have type

in the net HT package we have type

in the net HT package we have type Handler and type handler is an interface

Handler and type handler is an interface

Handler and type handler is an interface okay so an interface allows polymorphism

okay so an interface allows polymorphism

okay so an interface allows polymorphism and go so I click on that and I see type

and go so I click on that and I see type

and go so I click on that and I see type handler and anything that has this

handler and anything that has this

handler and anything that has this method implicitly implements the handler

method implicitly implements the handler

method implicitly implements the handler interface and that means that if I have

interface and that means that if I have

interface and that means that if I have some type and it has a method and that

some type and it has a method and that

some type and it has a method and that method has this signature and that a

method has this signature and that a

method has this signature and that a value of that type also is of a handler

value of that type also is of a handler

value of that type also is of a handler type

type

type and and so that’s how the interfaces

and and so that’s how the interfaces

and and so that’s how the interfaces work and again go watch the introduction

work and again go watch the introduction

work and again go watch the introduction training it doesn’t make sense because

training it doesn’t make sense because

training it doesn’t make sense because I’m going to try to keep this a little

I’m going to try to keep this a little

I’m going to try to keep this a little brief you got a little bit of like a

brief you got a little bit of like a

brief you got a little bit of like a hangnail I’m not totally weird all right

hangnail I’m not totally weird all right

hangnail I’m not totally weird all right so that’s the handler interface and

so that’s the handler interface and

so that’s the handler interface and serve HTTP response writer an employer

serve HTTP response writer an employer

serve HTTP response writer an employer to request my joke which I tell on class

to request my joke which I tell on class

to request my joke which I tell on class is what is a interface say says hey baby

is what is a interface say says hey baby

is what is a interface say says hey baby if you’ve got these methods then you’re

if you’ve got these methods then you’re

if you’ve got these methods then you’re my type so the handler interface and the

my type so the handler interface and the

my type so the handler interface and the reason the handler interface is the

reason the handler interface is the

reason the handler interface is the entry point for understanding the net

entry point for understanding the net

entry point for understanding the net HTTP package is because if you look up

HTTP package is because if you look up

HTTP package is because if you look up here handlers are used all over you see

here handlers are used all over you see

here handlers are used all over you see them in the index of all the different

them in the index of all the different

them in the index of all the different functions and things it’s like it’s used

functions and things it’s like it’s used

functions and things it’s like it’s used all over handler and their handler and

all over handler and their handler and

all over handler and their handler and particularly here right if we look for

particularly here right if we look for

particularly here right if we look for listening served there’s listen and

listening served there’s listen and

listening served there’s listen and serve and it takes an address in the

serve and it takes an address in the

serve and it takes an address in the handler and so that handler right here

handler and so that handler right here

handler and so that handler right here that we pass in right that’s going to be

that we pass in right that’s going to be

that we pass in right that’s going to be our server or serve MUX at the false or

our server or serve MUX at the false or

our server or serve MUX at the false or MUX or MUX whatever you want to call it

MUX or MUX whatever you want to call it

MUX or MUX whatever you want to call it and so if we pass in nil as I was

and so if we pass in nil as I was

and so if we pass in nil as I was passing in so let’s just go down here

passing in so let’s just go down here

passing in so let’s just go down here and look at it and we’ll search for nil

so there’s no and if you pass a nil you

so there’s no and if you pass a nil you use the default serve MUX okay so the

use the default serve MUX okay so the

use the default serve MUX okay so the default serve MUX well with the default

default serve MUX well with the default

default serve MUX well with the default serve MUX we can use handle and handle

serve MUX we can use handle and handle

serve MUX we can use handle and handle func handle and handle fog so handle and

func handle and handle fog so handle and

func handle and handle fog so handle and handle func registers the handler

handle func registers the handler

handle func registers the handler function for given pattern in the

function for given pattern in the

function for given pattern in the default serve MUX the defaults for MUX

default serve MUX the defaults for MUX

default serve MUX the defaults for MUX is your server so you can say server you

is your server so you can say server you

is your server so you can say server you can say router you could say serve mug

can say router you could say serve mug

can say router you could say serve mug so you say mugs it’s all pretty much the

so you say mugs it’s all pretty much the

so you say mugs it’s all pretty much the same the documentation for serve MUX

same the documentation for serve MUX

same the documentation for serve MUX explains how patterns are matched let me

explains how patterns are matched let me

explains how patterns are matched let me just show you so the starting point is

just show you so the starting point is

just show you so the starting point is HP listen and serve port 8080 mill right

HP listen and serve port 8080 mill right

HP listen and serve port 8080 mill right meaning to fall serve MUX and with the

meaning to fall serve MUX and with the

meaning to fall serve MUX and with the fall serve MUX we can use handle func

fall serve MUX we can use handle func

fall serve MUX we can use handle func HTTP handle func handle func wants a

HTTP handle func handle func wants a

HTTP handle func handle func wants a pattern and the string and then a

pattern and the string and then a

pattern and the string and then a function with that signature that is a

function with that signature that is a

function with that signature that is a type in go you can look at the language

type in go you can look at the language

type in go you can look at the language speculative speculation you can look at

speculative speculation you can look at

speculative speculation you can look at the language spec here’s the language

the language spec here’s the language

the language spec here’s the language spec and in the language spec you can

spec and in the language spec you can

spec and in the language spec you can see all the different types including

see all the different types including

see all the different types including function types first-class citizens

function types first-class citizens

function types first-class citizens right so we’ve got a type here go back

right so we’ve got a type here go back

right so we’ve got a type here go back to the documentation which is a function

to the documentation which is a function

to the documentation which is a function with that signature I’m in the pantry by

with that signature I’m in the pantry by

with that signature I’m in the pantry by the way because my kids are asleep I

the way because my kids are asleep I

the way because my kids are asleep I don’t want to make too much noise so

don’t want to make too much noise so

don’t want to make too much noise so it’s like my little sound booth so

it’s like my little sound booth so

it’s like my little sound booth so handle func takes the pattern string

handle func takes the pattern string

handle func takes the pattern string which is the route and then it takes a

which is the route and then it takes a

which is the route and then it takes a func with this signature so there’s my

func with this signature so there’s my

func with this signature so there’s my first func with that signature func

first func with that signature func

first func with that signature func index response writer pointer to request

index response writer pointer to request

index response writer pointer to request response write a pointer to request said

response write a pointer to request said

response write a pointer to request said now I’m wrapping up my whole deal so

now I’m wrapping up my whole deal so

now I’m wrapping up my whole deal so this route run this code this route run

this route run this code this route run

this route run this code this route run this code this route run this code

this code this route run this code

this code this route run this code that’s it

that’s it

that’s it these route from this code it’s totally

these route from this code it’s totally

these route from this code it’s totally cool

cool

cool so HB redirect here just to keep it easy

so HB redirect here just to keep it easy

so HB redirect here just to keep it easy keep it restful keep the route to

keep it restful keep the route to

keep it restful keep the route to meaningful HP redirect can redirect

meaningful HP redirect can redirect

meaningful HP redirect can redirect takes the response writer and by the way

takes the response writer and by the way

takes the response writer and by the way this is how servers work client-server

this is how servers work client-server

this is how servers work client-server architecture right it’s like a request

architecture right it’s like a request

architecture right it’s like a request comes in you write a response the

comes in you write a response the

comes in you write a response the request comes into the server to the

request comes into the server to the

request comes into the server to the server writes a response so that’s why

server writes a response so that’s why

server writes a response so that’s why this wants that signature because it’s

this wants that signature because it’s

this wants that signature because it’s like okay requests came in we got a

like okay requests came in we got a

like okay requests came in we got a right response requests came in got a

right response requests came in got a

right response requests came in got a write a response right that’s why you

write a response right that’s why you

write a response right that’s why you need to function with that signature so

need to function with that signature so

need to function with that signature so redirect takes the response to requests

redirect takes the response to requests

redirect takes the response to requests where you want to send and then the

where you want to send and then the

where you want to send and then the status code and that’s just a constant

status code and that’s just a constant

status code and that’s just a constant says you know hey it’s 303 the other

says you know hey it’s 303 the other

says you know hey it’s 303 the other which means if you come into default you

which means if you come into default you

which means if you come into default you end up getting taken to route books and

end up getting taken to route books and

end up getting taken to route books and that’s where you go and that serves this

that’s where you go and that serves this

that’s where you go and that serves this one looks index so if the request method

one looks index so if the request method

one looks index so if the request method is not yet you’re out of here each to be

is not yet you’re out of here each to be

is not yet you’re out of here each to be err can respond and the response writer

err can respond and the response writer

err can respond and the response writer and then the status text and and status

and then the status text and and status

and then the status text and and status method not allowed and then we return so

method not allowed and then we return so

method not allowed and then we return so if you try to post something to this

if you try to post something to this

if you try to post something to this route now we don’t take that method here

route now we don’t take that method here

route now we don’t take that method here when we get and then we do a database

when we get and then we do a database

when we get and then we do a database query and this DB here that comes from

query and this DB here that comes from

query and this DB here that comes from go doc I don’t know how much longer I

go doc I don’t know how much longer I

go doc I don’t know how much longer I keep going go dog database sequel all

keep going go dog database sequel all

keep going go dog database sequel all right and so here we have the DV stock

right and so here we have the DV stock

right and so here we have the DV stock and you look up at the top package

and you look up at the top package

and you look up at the top package sequel provides a generic interface

sequel provides a generic interface

sequel provides a generic interface around sequel databases must be using

around sequel databases must be using

around sequel databases must be using injunction with a database driver just

injunction with a database driver just

injunction with a database driver just your drivers car drivers let you drive

your drivers car drivers let you drive

your drivers car drivers let you drive something let’s go driving and here’s

something let’s go driving and here’s

something let’s go driving and here’s for Poe’s grass so I like this one here

for Poe’s grass so I like this one here

for Poe’s grass so I like this one here we go and you just get that driver get

we go and you just get that driver get

we go and you just get that driver get back here so on TV and

back here so on TV and

back here so on TV and we can do a query and a queries right

we can do a query and a queries right

we can do a query and a queries right here and here’s the query string where

here and here’s the query string where

here and here’s the query string where you put in your sequel

you put in your sequel

you put in your sequel you got any arguments it will take an

you got any arguments it will take an

you got any arguments it will take an unlimited 0 to unlimited number of

unlimited 0 to unlimited number of

unlimited 0 to unlimited number of arguments gives you back a pointer to

arguments gives you back a pointer to

arguments gives you back a pointer to rows so you just get the address back

rows so you just get the address back

rows so you just get the address back it’s pointer to an address for all the

it’s pointer to an address for all the

it’s pointer to an address for all the values are stored get a pointer to rows

values are stored get a pointer to rows

values are stored get a pointer to rows and then there with a pointer to rows

and then there with a pointer to rows

and then there with a pointer to rows you have all these methods available to

you have all these methods available to

you have all these methods available to you so you can do next and scan so you

you so you can do next and scan so you

you so you can do next and scan so you can do a for loop because next returns a

can do a for loop because next returns a

can do a for loop because next returns a bool so you get for loop over the next

bool so you get for loop over the next

bool so you get for loop over the next next next and you can scan and get the

next next and you can scan and get the

next next and you can scan and get the values and put it into the destination

values and put it into the destination

values and put it into the destination can we put it into the destination you

can we put it into the destination you

can we put it into the destination you need that pointer like I said if you

need that pointer like I said if you

need that pointer like I said if you don’t understand it could let go coarser

don’t understand it could let go coarser

don’t understand it could let go coarser so how is that use TB right it goes up

so how is that use TB right it goes up

so how is that use TB right it goes up here up here I have bar DB and from

here up here I have bar DB and from

here up here I have bar DB and from package sequel right DV I think I might

package sequel right DV I think I might

package sequel right DV I think I might set package TV earlier so that was just

set package TV earlier so that was just

set package TV earlier so that was just me being tired DB query you know from

me being tired DB query you know from

me being tired DB query you know from that DB query so pointer to DB x full

that DB query so pointer to DB x full

that DB query so pointer to DB x full query because let me just explain ER

query because let me just explain ER

query because let me just explain ER make sure it’s clear

make sure it’s clear

make sure it’s clear alright so package sequel package sequel

alright so package sequel package sequel

alright so package sequel package sequel package sequel I do open I get a pointer

package sequel I do open I get a pointer

package sequel I do open I get a pointer to a DB see that open pointer to DB and

to a DB see that open pointer to DB and

to a DB see that open pointer to DB and open takes a driver name and then like

open takes a driver name and then like

open takes a driver name and then like how do you connect to that database and

how do you connect to that database and

how do you connect to that database and that’s all specified and whatever driver

that’s all specified and whatever driver

that’s all specified and whatever driver you’re using so up here I create VAR DB

you’re using so up here I create VAR DB

you’re using so up here I create VAR DB from package sequel type DB a pointer to

from package sequel type DB a pointer to

from package sequel type DB a pointer to it right and then here I do from package

it right and then here I do from package

it right and then here I do from package sequel open from package sequel open and

sequel open from package sequel open and

sequel open from package sequel open and then I pass in the driver name Postgres

then I pass in the driver name Postgres

then I pass in the driver name Postgres and I pass in the datasource stuff so

and I pass in the datasource stuff so

and I pass in the datasource stuff so here it is it’s how you connect Postgres

here it is it’s how you connect Postgres

here it is it’s how you connect Postgres close grass username password then all

close grass username password then all

close grass username password then all that stuff move this over come to reason

that stuff move this over come to reason

that stuff move this over come to reason that

that

that and so now DB when you do open it gives

and so now DB when you do open it gives

and so now DB when you do open it gives you back a pointer to a DP with a

you back a pointer to a DP with a

you back a pointer to a DP with a pointer to DB a value of type DB to be

pointer to DB a value of type DB to be

pointer to DB a value of type DB to be specific with my language when you have

specific with my language when you have

specific with my language when you have a pointer to type DB you have all these

a pointer to type DB you have all these

a pointer to type DB you have all these methods available I can now run query

methods available I can now run query

methods available I can now run query this one right here so I have a pointer

this one right here so I have a pointer

this one right here so I have a pointer to DB here I ping it just to make sure

to DB here I ping it just to make sure

to DB here I ping it just to make sure we really connect to the database and

we really connect to the database and

we really connect to the database and what the pointer to DB I can do that

what the pointer to DB I can do that

what the pointer to DB I can do that query pass in my sequel and when I do

query pass in my sequel and when I do

query pass in my sequel and when I do that gives me back roses in there check

that gives me back roses in there check

that gives me back roses in there check my air right here there are my rows and

my air right here there are my rows and

my air right here there are my rows and then I do my four rows next so that

then I do my four rows next so that

then I do my four rows next so that returns a bool long as there’s another

returns a bool long as there’s another

returns a bool long as there’s another record it’ll be true true true false no

record it’ll be true true true false no

record it’ll be true true true false no more records were done and then I do

more records were done and then I do

more records were done and then I do rows scan and I give it give it a

rows scan and I give it give it a

rows scan and I give it give it a pointer to where I want that value

pointer to where I want that value

pointer to where I want that value stored and I match it up tries the

stored and I match it up tries the

stored and I match it up tries the entitled look hot and here I have a

entitled look hot and here I have a

entitled look hot and here I have a slice of book a book is a struck with

slice of book a book is a struck with

slice of book a book is a struck with ISBN title author prices struct is just

ISBN title author prices struct is just

ISBN title author prices struct is just an aggregate composite data structure

an aggregate composite data structure

an aggregate composite data structure and it holds all of your uh all your

and it holds all of your uh all your

and it holds all of your uh all your other data whatever other pieces of data

other data whatever other pieces of data

other data whatever other pieces of data you want to put in there stick them in

you want to put in there stick them in

you want to put in there stick them in astruc composes together composite a

astruc composes together composite a

astruc composes together composite a structure to aggregate aggregates

structure to aggregate aggregates

structure to aggregate aggregates together as much data as you want

together as much data as you want

together as much data as you want alright so that’s a book here’s a slice

alright so that’s a book here’s a slice

alright so that’s a book here’s a slice a book which is books so I’m appending

a book which is books so I’m appending

a book which is books so I’m appending two books each book and that pass all

two books each book and that pass all

two books each book and that pass all those books in here this one I have my

those books in here this one I have my

those books in here this one I have my templates in go so I pass in books which

templates in go so I pass in books which

templates in go so I pass in books which is a slice and then I range over all

is a slice and then I range over all

is a slice and then I range over all those books and for each book I print

those books and for each book I print

those books and for each book I print out the ISBN titled author the price

very sweet to beautiful language it’s

very sweet to beautiful language it’s very elegant really clean once you

very elegant really clean once you

very elegant really clean once you understand it

understand it

understand it man codes so nice so that’s books and

man codes so nice so that’s books and

man codes so nice so that’s books and then the rest of it is a lot like that

then the rest of it is a lot like that

then the rest of it is a lot like that like books show instead of getting all

like books show instead of getting all

like books show instead of getting all the books and using query less are just

the books and using query less are just

the books and using query less are just fun past we use query row and that just

fun past we use query row and that just

fun past we use query row and that just gives us one row where we’re saying hey

gives us one row where we’re saying hey

gives us one row where we’re saying hey where is B n is equal to you know

where is B n is equal to you know

where is B n is equal to you know whatever the ISBN is just for and that’s

whatever the ISBN is just for and that’s

whatever the ISBN is just for and that’s the Postgres right there that’s just how

the Postgres right there that’s just how

the Postgres right there that’s just how you had done it pass in and identify a

you had done it pass in and identify a

you had done it pass in and identify a parameter to a sequel standard and then

parameter to a sequel standard and then

parameter to a sequel standard and then it’s the same way the other thing which

it’s the same way the other thing which

it’s the same way the other thing which is neat is a let me see here here’s

is neat is a let me see here here’s

is neat is a let me see here here’s where we create a book so we get form

where we create a book so we get form

where we create a book so we get form submissions and you can look at form

submissions and you can look at form

submissions and you can look at form value here so from my request I want the

value here so from my request I want the

value here so from my request I want the form value you can go in and look at

form value you can go in and look at

form value you can go in and look at that and that will give it from the body

that and that will give it from the body

that and that will give it from the body parameters and forms been submitted or

parameters and forms been submitted or

parameters and forms been submitted or from the URL that’s how form value works

from the URL that’s how form value works

from the URL that’s how form value works so we’re getting it from the URL so just

so we’re getting it from the URL so just

so we’re getting it from the URL so just give me the form value or a sign in it

give me the form value or a sign in it

give me the form value or a sign in it we create a book write using the

we create a book write using the

we create a book write using the composite literal composite literals the

composite literal composite literals the

composite literal composite literals the type and then curly braces we’re putting

type and then curly braces we’re putting

type and then curly braces we’re putting nothing in it so there’s nothing in

nothing in it so there’s nothing in

nothing in it so there’s nothing in there yet

there yet

there yet but then we accept ISBN equal to that

but then we accept ISBN equal to that

but then we accept ISBN equal to that title that and then for the price that

title that and then for the price that

title that and then for the price that came back as a string so we now have to

came back as a string so we now have to

came back as a string so we now have to take that P and parse it as a float so

take that P and parse it as a float so

take that P and parse it as a float so string convert parse is float we want

string convert parse is float we want

string convert parse is float we want parse is a float 32 right and I give

parse is a float 32 right and I give

parse is a float 32 right and I give this back a float

this back a float

this back a float sorry parse it as that’s kind of weird

sorry parse it as that’s kind of weird

sorry parse it as that’s kind of weird float 32 parses float 3 I’m going to

float 32 parses float 3 I’m going to

float 32 parses float 3 I’m going to check that code and think that’s good

check that code and think that’s good

check that code and think that’s good for a second here parsefloat converts

for a second here parsefloat converts

for a second here parsefloat converts the string as to a floating-point number

the string as to a floating-point number

the string as to a floating-point number with precision specified by bit size 32

with precision specified by bit size 32

with precision specified by bit size 32 for float 32 or 64 explode 64 we’re bit

for float 32 or 64 explode 64 we’re bit

for float 32 or 64 explode 64 we’re bit size of 32 the result still has type

size of 32 the result still has type

size of 32 the result still has type float 64 but it will be convertible to

float 64 but it will be convertible to

float 64 but it will be convertible to float 32 without changing its value so

float 32 without changing its value so

float 32 without changing its value so that was an area my Park can change just

that was an area my Park can change just

that was an area my Park can change just that part that’s what

that part that’s what

that part that’s what you float32 I think it said still

you float32 I think it said still

you float32 I think it said still float64 there’s ol still has tight

float64 there’s ol still has tight

float64 there’s ol still has tight float64 so that’s not an era apart

float64 so that’s not an era apart

float64 so that’s not an era apart change that back so that’s still tight

change that back so that’s still tight

change that back so that’s still tight float64 which seems weird it’s 32 now we

float64 which seems weird it’s 32 now we

float64 which seems weird it’s 32 now we do DB exec so DB exec is where is it

do DB exec so DB exec is where is it

do DB exec so DB exec is where is it it’s right here so exact execute is how

it’s right here so exact execute is how

it’s right here so exact execute is how you execute another query right you want

you execute another query right you want

you execute another query right you want to do some of you or excuse some other

to do some of you or excuse some other

to do some of you or excuse some other sequel you don’t just want to do a query

sequel you don’t just want to do a query

sequel you don’t just want to do a query a query row but you want to insert or

a query row but you want to insert or

a query row but you want to insert or update use XQ and it gives you back a

update use XQ and it gives you back a

update use XQ and it gives you back a result and air so result just tells you

result and air so result just tells you

result and air so result just tells you like how many rows were affected or what

like how many rows were affected or what

like how many rows were affected or what the results of your executed sequel

the results of your executed sequel

the results of your executed sequel statement was and and so you do that

statement was and and so you do that

statement was and and so you do that DB execute and then insert into bugs you

DB execute and then insert into bugs you

DB execute and then insert into bugs you know those those those fields in the

know those those those fields in the

know those those those fields in the database and then these values and it

database and then these values and it

database and then these values and it inserts record and then updates very

inserts record and then updates very

inserts record and then updates very similar so you just do here we go update

similar so you just do here we go update

similar so you just do here we go update update form oak updates form this one

update form oak updates form this one

update form oak updates form this one was what create processbook update form

was what create processbook update form

was what create processbook update form here’s book update process and so update

here’s book update process and so update

here’s book update process and so update process is another DB execute update

process is another DB execute update

process is another DB execute update books set is be into this can it updates

books set is be into this can it updates

books set is be into this can it updates it and then delete is just TVXQ delete

it and then delete is just TVXQ delete

it and then delete is just TVXQ delete from books where this is acquired p.m.

from books where this is acquired p.m.

from books where this is acquired p.m. it’s pretty elegant pretty beautiful you

it’s pretty elegant pretty beautiful you

it’s pretty elegant pretty beautiful you are operating at the level of complete

are operating at the level of complete

are operating at the level of complete understanding when you use this you have

understanding when you use this you have

understanding when you use this you have an abstracted away your responsibility

an abstracted away your responsibility

an abstracted away your responsibility as a engineer and a programmer to know

as a engineer and a programmer to know

as a engineer and a programmer to know what you’re doing

what you’re doing

what you’re doing and that doesn’t mean we’re all going to

and that doesn’t mean we’re all going to

and that doesn’t mean we’re all going to build our own CPUs and and write

build our own CPUs and and write

build our own CPUs and and write everything in zeros ones we still have

everything in zeros ones we still have

everything in zeros ones we still have strapped away into a language but you

strapped away into a language but you

strapped away into a language but you understand methods you understand status

understand methods you understand status

understand methods you understand status codes right we’ve got methods here we’ve

codes right we’ve got methods here we’ve

codes right we’ve got methods here we’ve got status codes

got status codes

got status codes you know you’re looking at the forum

you know you’re looking at the forum

you know you’re looking at the forum values coming back you know you’re

values coming back you know you’re

values coming back you know you’re working in a static language you’re

working in a static language you’re

working in a static language you’re doing your right conversions you’re

doing your right conversions you’re

doing your right conversions you’re checking your types you’re doing all of

checking your types you’re doing all of

checking your types you’re doing all of your restful routing it’s really the

your restful routing it’s really the

your restful routing it’s really the best way to go you’re not relying on

best way to go you’re not relying on

best way to go you’re not relying on somebody else to build some framework

somebody else to build some framework

somebody else to build some framework where you don’t really understand the

where you don’t really understand the

where you don’t really understand the fundamentals and the language you’re

fundamentals and the language you’re

fundamentals and the language you’re working with but are instead up at some

working with but are instead up at some

working with but are instead up at some abstracted level working in the way

abstracted level working in the way

abstracted level working in the way somebody else prescribed restricting you

somebody else prescribed restricting you

somebody else prescribed restricting you not giving you flexibility slowing down

not giving you flexibility slowing down

not giving you flexibility slowing down your performance you don’t want that you

your performance you don’t want that you

your performance you don’t want that you want to learn how to do it real do it

want to learn how to do it real do it

want to learn how to do it real do it right so that’s just a little bit I just

right so that’s just a little bit I just

right so that’s just a little bit I just have to get this out here man because

have to get this out here man because

have to get this out here man because this stuff is like many years in process

this stuff is like many years in process

this stuff is like many years in process to you know get a code pathway and and

to you know get a code pathway and and

to you know get a code pathway and and this solution right here is like the

this solution right here is like the

this solution right here is like the best T sweetest and you know the

best T sweetest and you know the

best T sweetest and you know the clearest just this one little example

clearest just this one little example

clearest just this one little example right here this culmination of the

right here this culmination of the

right here this culmination of the Postgres section is actually a

Postgres section is actually a

Postgres section is actually a culmination of so much of years of work

culmination of so much of years of work

culmination of so much of years of work of many people so if you found this to

of many people so if you found this to

of many people so if you found this to be beneficial and if it gave you insight

be beneficial and if it gave you insight

be beneficial and if it gave you insight please like this video and tweet it and

please like this video and tweet it and

please like this video and tweet it and share with others even though my voice

share with others even though my voice

share with others even though my voice is all whacked and and I want to I want

is all whacked and and I want to I want

is all whacked and and I want to I want to get that message out there to people

to get that message out there to people

to get that message out there to people that you know look at how you should be

that you know look at how you should be

that you know look at how you should be doing go programming web dev we gotta

doing go programming web dev we gotta

doing go programming web dev we gotta get this video replaced so thanks for

get this video replaced so thanks for

get this video replaced so thanks for watching and I hope this was helpful and

watching and I hope this was helpful and

watching and I hope this was helpful and if you have any questions or you know

if you have any questions or you know

if you have any questions or you know anything you can find me on Twitter and

anything you can find me on Twitter and

anything you can find me on Twitter and I watch that several times a week and so

I watch that several times a week and so

I watch that several times a week and so I love connect with people around the

I love connect with people around the

I love connect with people around the world and I think it’s fantastic this

world and I think it’s fantastic this

world and I think it’s fantastic this amazing world we live in now and so

amazing world we live in now and so

amazing world we live in now and so don’t hesitate to reach out if you want

don’t hesitate to reach out if you want

don’t hesitate to reach out if you want to access to my courses for free just

to access to my courses for free just

to access to my courses for free just let me know be more than happy to help

let me know be more than happy to help

let me know be more than happy to help if you don’t have the financial means

if you don’t have the financial means

if you don’t have the financial means pay for it it’s my honor to return the

pay for it it’s my honor to return the

pay for it it’s my honor to return the favor so many people helped me in life

favor so many people helped me in life

favor so many people helped me in life with my education to my honor to give it

with my education to my honor to give it

with my education to my honor to give it back all right you all have a good day

”

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *