Beego Database Migration
Golang Programs | Golang Tutorial
by
5y ago
Driver for Database Package Using Git Bash first install driver for Go's database/sql package. Run below two commands one-by-one and install both MySQL and Postgresql driver's 1. go get github.com/lib/pq 2. go get -u github.com/go-sql-driver/mysql Creating Goblog Database 1. Open PHPMyAdmin/SQLyog or what ever MySQL database management tool that you are using. 2. Create a new database "goblog" Note: Be ready with your database username and password; make sure it must match with the ones on your system. Migration Command When you create a migration file, Beego stores it in [/database/m ..read more
Visit website
Golang basic examples of Date and Time manipulation functions
Golang Programs | Golang Tutorial
by
5y ago
1) How to get the current date and time with timestamp in local and other timezones ? 2) Example to use Weekday and YearDay function 3) Golang Get current Date and Time in EST, UTC and MST? 4) Get Hours, Days, Minutes and Seconds difference between two dates [Future and Past] 5) Add N number of Year, Month, Day, Hour, Minute, Second, Millisecond, Microsecond and Nanosecond to current datetime 6) Subtract N number of Year, Month, Day, Hour, Minute, Second, Millisecond, Microsecond and Nanosecond to current datetime 7) Get current date and time in various format in golang 8) Get Yea ..read more
Visit website
Most Popular Golang Slice Sort, Reverse, Search Functions
Golang Programs | Golang Tutorial
by
5y ago
Slice sorting or searching functions allow you to interact with and manipulate slice in various ways. Golang sort functions are the part of the core. There is no installation required to use this function only you need to import "sort" package. With the help of sort function you can search any A list of important Golang sort functions are as follow: 1) Golang Ints function [ascending order] The Ints function sorts a slice of integer in ascending order. Syntax: func Ints(intSlice []int) Example: package main import ( "fmt" "sort" ) func main() { intSlice := []int{10 ..read more
Visit website
Most Popular Golang String Functions
Golang Programs | Golang Tutorial
by
5y ago
Golang provides a number of built-in string functions which help in performing several operations while dealing with string data. Golang string functions are the part of the core. There is no installation required to use this function only you need to import "strings" package. A list of important Golang string functions are as follow: 1) Golang Compare function [comparing two strings lexicographically] You can compare two strings by using Compare(). It returns output either greater than zero, less than zero or equal to zero. If string 1 is greater than string 2 then it returns greater than ..read more
Visit website
Design philosophy of Golang interface type
Golang Programs | Golang Tutorial
by
5y ago
Implementing a Go interface is done implicitly. In Go, there is no need to explicitly implement an interface into a concrete type by specifying any keyword. To implement an interface into a concrete type, just provide the methods with the same signature that is defined in the interface type. An interface type is defined with the keyword interface. An interface defines a set of methods (the method set), but these methods do not contain code: they are not implemented (they are abstract). A method set is a list of methods that a type must have in order to implement the interface. Also an interf ..read more
Visit website
Methods and Objects
Golang Programs | Golang Tutorial
by
5y ago
Go methods A method is defined just like any other Go function. When a Go function is defined with a limited scope or attached with a specific type it is known as a method. Methods provide a way to add behavior to user-defined types. Methods are really functions that contain an extra parameter that's declared between the keyword func and the function name. In Go a method is a special kind of function that acts on variable of a certain type, called the receiver, which is an extra parameter placed before the method's name, used to specify the moderator type to which the method is attached ..read more
Visit website
Beego process simple form using GET and POST method
Golang Programs | Golang Tutorial
by
5y ago
In below example we are creating a simple Contact Us page. For which we are creating a form in template, new controller, set the route for controller, call Get method to load the page and send the form data using Post moethod. Step 1: Go to the views folder [src\demoProject\views] and create basic layout which we can use in all CMS pages. - Create homelayout.html write below code in head section. {{.Title}} - Add below code in body section. {{.LayoutContent}} - Now Create another file contactusTemplate.html with below code ..read more
Visit website
Beego create simple Route and use GET method to display page content
Golang Programs | Golang Tutorial
by
5y ago
In below example we are creating a simple About Us page. For which we are creating a new controller, set the route for controller, call Get method to load the page and content for that page. Step 1: Go to the views folder [src\demoProject\views] and create basic layout which we can use in all CMS pages. - Create homelayout.html write below code in head section. {{.Title}} - Add below code in body section. {{.LayoutContent}} - Now Create another file aboutTemplate.html with below code. {{.Name}} {{str2html .Content ..read more
Visit website
Beego Setup and installation on Windows server
Golang Programs | Golang Tutorial
by
5y ago
I)Prerequisites and Go Variable Settings To start the installation process, first you need to download Git for Windows and update below required settings for GO environment variables. 1: Go the the link https://git-scm.com/download/win and download the latest version Git for Windows. Once you click on the Download button for the latest Git for Windows version, the installation exe will be saved to your hard disk. Locate the exe that you've just downloaded and run it. Follow the step of installation; once the installation completed you can verify by right click on desktop or any folder ..read more
Visit website

Follow Golang Programs | Golang Tutorial on FeedSpot

Continue with Google
Continue with Apple
OR