1
00:00:02,020 --> 00:00:07,900
So some of you may be coming to Goaland from a language like PHP and a framework like Laravel or there

2
00:00:07,900 --> 00:00:14,880
are other ones in other languages, but all of those frameworks tend to use object relational mappers.

3
00:00:14,890 --> 00:00:18,430
And the one in Laravel, which is on the screen in front of you, is called eloquent.

4
00:00:18,760 --> 00:00:23,870
And the intention of this particular package is to make interacting with the database much easier.

5
00:00:24,370 --> 00:00:30,970
So, for example, if we come down here, you can define a model and give certain rules to that model

6
00:00:30,970 --> 00:00:32,220
and to query the database.

7
00:00:32,230 --> 00:00:38,000
For example, if we get down to database connections or a little bit further retrieving models.

8
00:00:38,020 --> 00:00:44,710
So you have a model like this, you can say, go get flight, all go to the flight's table in the database

9
00:00:44,710 --> 00:00:46,600
and get all the records and then loop through them.

10
00:00:47,380 --> 00:00:52,680
And you will notice as I go through this course that I'm not using an object, relational mapper.

11
00:00:52,690 --> 00:00:56,170
And most people that are experienced and go tend to avoid them.

12
00:00:56,440 --> 00:00:57,370
They exist.

13
00:00:57,370 --> 00:00:59,010
And I want to draw a couple to your attention.

14
00:00:59,500 --> 00:01:06,220
They exist, but they're really not used that frequently by people that work in go on a daily basis.

15
00:01:06,460 --> 00:01:12,760
For example, there's one called Gorm and it's at Gormogon IO and it does give you most of the same

16
00:01:12,760 --> 00:01:16,940
functionality that you would get in something like Eloquent in Laravel.

17
00:01:17,530 --> 00:01:21,790
The problem with these, from my perspective and from the perspective of lots of people, is that they

18
00:01:21,790 --> 00:01:26,100
add a completely unnecessary layer of complexity to interacting with your database.

19
00:01:26,620 --> 00:01:33,100
What most people that work in go on a regular basis tend to do is to write a sequel, to write a sequel

20
00:01:33,220 --> 00:01:36,640
exactly as you would if you're interacting with the database from a command line.

21
00:01:36,940 --> 00:01:41,590
And they do that because it removes a layer of complexity and it results in faster code.

22
00:01:42,340 --> 00:01:46,900
Eloquent, for example, does make it easier for people that aren't that familiar with SQL to work with

23
00:01:46,900 --> 00:01:51,930
the database, but it slows things down a great deal in some cases.

24
00:01:52,330 --> 00:01:56,640
So I'm not going to be using Gorm and another one that I'll draw your attention.

25
00:01:56,660 --> 00:01:58,660
And I actually like this one much more than I like.

26
00:01:58,660 --> 00:02:04,130
Gorm and I have used this in the past, is called Upper DB and it works very well.

27
00:02:04,150 --> 00:02:07,570
It is completely agnostic, it works with postgrads.

28
00:02:07,570 --> 00:02:13,250
It works with pretty much any database you would probably be using and it is extremely easy to use.

29
00:02:13,510 --> 00:02:21,880
So for example, they're on on the website up or up or Geographe for it gives you examples of how things

30
00:02:21,880 --> 00:02:23,830
work and you can go through these at your leisure.

31
00:02:23,830 --> 00:02:29,290
And if you find that this is a useful thing for you to incorporate into your code, don't feel guilty

32
00:02:29,290 --> 00:02:30,010
for doing it.

33
00:02:30,260 --> 00:02:31,270
Lots of people do it.

34
00:02:31,480 --> 00:02:33,070
It's just that I tend not to.

35
00:02:33,070 --> 00:02:36,580
And in this course, I want you to become familiar with working with sequel.

36
00:02:37,030 --> 00:02:43,480
So we'll be doing it the old fashioned way, which is faster, easy to maintain and not that difficult.
