1 00:00:11,990 --> 00:00:17,630 Hello and welcome to the Golang programming language course in the previous session, we could define 2 00:00:17,630 --> 00:00:24,980 to create the save method and insert some records into the database and in decision, we want to create 3 00:00:24,980 --> 00:00:30,920 the function to select the statement, to fetch all the student records from person database. 4 00:00:31,670 --> 00:00:42,110 So go to DB connection that go, find and define the function name select find. 5 00:00:43,250 --> 00:00:43,940 Select 6 00:00:48,320 --> 00:00:49,430 this function. 7 00:00:49,430 --> 00:00:57,590 Accept a slice of A-student as parameter and retrieve all students of a student table in person database. 8 00:00:57,950 --> 00:01:04,250 So we write a student's object as parameter to students. 9 00:01:06,950 --> 00:01:10,850 A slice of mother law student. 10 00:01:18,820 --> 00:01:25,690 Now cutting connect function for initializing MySchool data source name, this function returns a DB 11 00:01:25,690 --> 00:01:27,880 object from gore and package. 12 00:01:28,270 --> 00:01:33,940 So first, define a variable like DB calling equals and calling connect function. 13 00:01:37,350 --> 00:01:44,280 After creating a DBI object from GLAA and package the Invoke Find function, this function, except 14 00:01:44,280 --> 00:01:50,900 it is life of a student instance, then running said Aquarium is student table and feel a student's 15 00:01:50,940 --> 00:01:54,840 life by fishing his students from a database and return it. 16 00:01:55,140 --> 00:02:02,520 So we ride DB dot culling, find function and select a students. 17 00:02:03,200 --> 00:02:05,250 Enter students. 18 00:02:09,220 --> 00:02:13,900 Now we use the range blue to display each member in the student list. 19 00:02:14,650 --> 00:02:27,610 So we write for on the school set a variable like a student, Cullen equals range in the student's. 20 00:02:32,240 --> 00:02:37,430 And now calling printer functions from 50 pages to display each record. 21 00:02:38,120 --> 00:02:39,050 If Earth 22 00:02:41,900 --> 00:02:53,810 now using Person B for a student I.D. and sit back A for creates space and person s for Essendon name 23 00:02:53,810 --> 00:03:03,440 and a game that is thirsty and for a student age percent d and sit like this and to go to the new line 24 00:03:03,650 --> 00:03:19,550 and set variables as student darts I.D., the student name and a student start page. 25 00:03:22,070 --> 00:03:25,760 OK, reformat the coat and save the project. 26 00:03:26,090 --> 00:03:30,620 Now we could create the function fonctionnent silhouette that fits all students. 27 00:03:31,250 --> 00:03:35,450 It's time to go to the main function to use this query statement. 28 00:03:36,290 --> 00:03:40,340 So go to the main file and go to the main function. 29 00:03:40,940 --> 00:03:42,650 First, clear the last code. 30 00:03:45,750 --> 00:03:52,050 In this case, we want to select honest students from person database, so first, create a slice of 31 00:03:52,170 --> 00:04:06,120 student is less than the student's slice of model of the student now cutting select function from debate 32 00:04:06,120 --> 00:04:16,830 rules, package and pass students slice as arguments to eat daily tools, dot, select and pass students. 33 00:04:18,950 --> 00:04:27,380 Reformat the court, save the project and execute the program, go run dot backsplash, Maine and Maine 34 00:04:27,380 --> 00:04:28,100 that go. 35 00:04:31,690 --> 00:04:35,620 Now we can see the output, all the students are displayed. 36 00:04:35,950 --> 00:04:43,180 We could create a select function that fits all members of student data in person database in order 37 00:04:43,180 --> 00:04:45,100 not to prolong the time of decision. 38 00:04:45,280 --> 00:04:50,780 We will finish it and we will continue the content in the next session until next session. 39 00:04:50,800 --> 00:04:51,310 Goodbye.