1 00:00:12,030 --> 00:00:17,940 Hello and welcome to the golden programming language course in the previous session, we talked about 2 00:00:17,940 --> 00:00:25,080 protocol for concept, and in this session it's time to go to this school program to illustrate how 3 00:00:25,080 --> 00:00:26,850 to use political power. 4 00:00:26,940 --> 00:00:32,280 First, go to Explorer and create a project folder like name library 5 00:00:36,810 --> 00:00:38,910 line breaks. 6 00:00:39,600 --> 00:00:43,020 Create a folder inside it named Harcourt. 7 00:00:46,040 --> 00:00:59,240 True to call and create a find card with the Porto extension inside its bow to prove to. 8 00:01:03,150 --> 00:01:10,230 First, we define the scene text inside it and said it's value equal to PER2 three, which will represent 9 00:01:10,230 --> 00:01:11,940 the port call buffer version. 10 00:01:12,750 --> 00:01:13,830 Syntax 11 00:01:16,050 --> 00:01:19,470 equals proto three. 12 00:01:24,760 --> 00:01:29,200 Now define option and sit go on the score package value. 13 00:01:29,830 --> 00:01:39,080 So we write option go on underscore package equals cash flow to 14 00:01:43,150 --> 00:01:43,660 go on. 15 00:01:43,660 --> 00:01:50,410 The Restore package option defines the import path of the package, which will contain all the generated 16 00:01:50,410 --> 00:01:51,790 code for this fine. 17 00:01:52,090 --> 00:01:56,440 The gold package name will be the last pass component of the import pass. 18 00:01:57,430 --> 00:01:59,140 Now define port call off. 19 00:01:59,170 --> 00:02:02,530 For example, we won't name it Bauchi soul, right? 20 00:02:04,450 --> 00:02:05,320 Message 21 00:02:07,840 --> 00:02:08,310 board. 22 00:02:11,770 --> 00:02:18,550 And define two variables first name by this string type and second Espeon by the aid type. 23 00:02:19,350 --> 00:02:24,220 A strange name equals one. 24 00:02:25,910 --> 00:02:32,300 And it turned to ice in equals to 25 00:02:35,330 --> 00:02:38,870 in order to be able to use our vertical bar for killers. 26 00:02:38,900 --> 00:02:40,850 We must first compile it. 27 00:02:41,420 --> 00:02:42,890 Then we compound it. 28 00:02:43,010 --> 00:02:50,360 Find with the extensions Dot PBE Dot Go is created inside the project, which is the equivalent of the 29 00:02:50,360 --> 00:02:51,290 port call baffling. 30 00:02:51,290 --> 00:02:57,590 Go back and we will access the components in the protocol before through the created a distraught fun 31 00:02:58,730 --> 00:03:03,710 before the compound, first in a star requirements packages so bright. 32 00:03:07,500 --> 00:03:09,570 City Library, 33 00:03:13,410 --> 00:03:14,070 go. 34 00:03:16,170 --> 00:03:36,420 Get that you Google Docs, go like dot org slash proto off first execute this command and after eat 35 00:03:37,380 --> 00:03:39,980 this slash for it all. 36 00:03:42,690 --> 00:03:46,380 And after Randy's comment, Rahm. 37 00:03:49,110 --> 00:04:01,750 C and D slash pro to Dash Gen Dash go first in a star. 38 00:04:01,770 --> 00:04:03,720 These three conference. 39 00:04:06,100 --> 00:04:13,020 Before I installed them, required details were installed, now it's time to compile our political power 40 00:04:13,020 --> 00:04:22,290 for fine to create the equivalent golden fine, so go to project paths and write compile command pro 41 00:04:22,300 --> 00:04:24,700 talk dot. 42 00:04:25,060 --> 00:04:34,440 The Dash Dash go on score out equals four destination. 43 00:04:34,450 --> 00:04:39,970 We set Dart that indicate current pass and four source pass. 44 00:04:39,970 --> 00:04:50,410 Go to the particle package and call book Dark Portal fine for a little code and call book Dark Portal 45 00:04:50,800 --> 00:04:52,450 and execute the command. 46 00:04:54,590 --> 00:05:04,520 OK, we can see that if fine, Carl Butch got that go extension was created in the Project Pass, which 47 00:05:04,520 --> 00:05:07,190 we can use to exchange our data. 48 00:05:07,790 --> 00:05:15,560 Now go to the root of project and create a main file and create main function to use these political 49 00:05:15,560 --> 00:05:29,030 buffer, create creative phone, may the school package name and create main function for me. 50 00:05:33,020 --> 00:05:38,300 First, define a variable from book history and initialize it. 51 00:05:39,230 --> 00:05:46,600 For example, in Bhuj call calling equals ampersand protocol. 52 00:05:49,970 --> 00:05:50,270 Are. 53 00:05:53,600 --> 00:06:02,840 Bush and initialize its name, for example, go programming 54 00:06:05,120 --> 00:06:06,200 language 55 00:06:08,900 --> 00:06:10,960 and ESPN, for example. 56 00:06:11,330 --> 00:06:14,690 One, two, three, four, five and six. 57 00:06:17,470 --> 00:06:25,270 Notice that the films start with a capital letter now, then we use the martial function from or package 58 00:06:25,270 --> 00:06:31,330 to serialize our port call Barford data and is stored in the data variable, which we display. 59 00:06:31,870 --> 00:06:34,240 This will print our encoded data. 60 00:06:34,600 --> 00:06:40,930 This function accept a port the message object as input parameter and return to values. 61 00:06:40,930 --> 00:06:44,020 First, a slice of byte and second, an error value. 62 00:06:44,260 --> 00:06:48,790 So define two variable light data and or data. 63 00:06:49,720 --> 00:06:58,920 Comma error call an equals and calling marschall function from protocol package pro tool. 64 00:07:01,690 --> 00:07:04,210 There are more shy 65 00:07:07,510 --> 00:07:10,060 and sit book as per the message. 66 00:07:13,540 --> 00:07:15,250 Now check error status. 67 00:07:20,110 --> 00:07:28,300 Lock the FATTORE and set a message marshalling. 68 00:07:33,790 --> 00:07:34,420 There were. 69 00:07:40,620 --> 00:07:48,750 Now, given to this serialized encoded message, I read a political buffer, so we declare a new pointer 70 00:07:48,750 --> 00:07:58,350 to the book it struck with empty fields, new blue collar equals Anderson protocol. 71 00:08:00,060 --> 00:08:03,360 Not much. 72 00:08:05,280 --> 00:08:12,930 Then we use the John Marshall function to DC, the encoded message stored in the data and this store 73 00:08:12,930 --> 00:08:21,480 in a new book on Marshall Function, passes the white forward message in by this nice variable and places 74 00:08:21,480 --> 00:08:23,490 the result in portal message. 75 00:08:24,180 --> 00:08:29,580 So first, define an error variable and common marshall function from Portal package. 76 00:08:30,030 --> 00:08:37,980 Go to the next line ETL equals and calling on all function from Pluto. 77 00:08:38,370 --> 00:08:39,270 Pluto 78 00:08:41,730 --> 00:08:55,260 got on more solid punch and sent data variable as binary data and set new book as per the message is 79 00:08:55,260 --> 00:08:55,820 resolved. 80 00:08:55,830 --> 00:08:57,900 Value new book. 81 00:09:05,010 --> 00:09:06,570 And check your status, 82 00:09:10,140 --> 00:09:21,600 lock Dot's baton and set a message for a role on marshalling that will 83 00:09:27,240 --> 00:09:36,360 finally be used together, Metal Gear its name and get ESPN that provided in our generated code to retrieve 84 00:09:36,360 --> 00:09:40,470 and print the fields for display Balkany value. 85 00:09:40,470 --> 00:09:44,840 We can't get name gear to solve you, right FP. 86 00:09:47,360 --> 00:09:49,450 Name calling. 87 00:09:51,640 --> 00:09:55,810 New book Don't Get Me. 88 00:09:59,920 --> 00:10:09,310 And for display book, I spin value, we can get and get a if p ESPN. 89 00:10:13,600 --> 00:10:17,620 New for the ice spin, 90 00:10:21,250 --> 00:10:32,650 the format to cool down, save the project, now let's go to round the project, go to terminal and 91 00:10:32,650 --> 00:10:41,200 run the project, go from Dot Backer Slash Maine dot com. 92 00:10:43,810 --> 00:10:51,280 Now we can see the output main go programming language and ISBN one two three four five six. 93 00:10:51,730 --> 00:10:57,730 So we were able to create a protocol buffer and use it inside the main method. 94 00:10:58,780 --> 00:11:06,250 First, the data were serialized using the marsh and function of the Portal package and displayed then 95 00:11:06,250 --> 00:11:14,170 serialized data by the en marche en fonction from the port of package is exist, serialized or the other 96 00:11:14,170 --> 00:11:17,730 words, these serialized end displays OK. 97 00:11:17,740 --> 00:11:23,290 In order not to prolong the time of decision, we will finish it and we will continue the content in 98 00:11:23,290 --> 00:11:24,220 the next session. 99 00:11:24,430 --> 00:11:25,000 Goodbye.