Gogland : Datasource explorer
While coding with Gogland IDE, I need to browse a database to see how a particular table is structured in order for me to write the proper struct
SQL mapping.
For example :
// Activities table SQL :
// id bigint(20) AUTO_INCREMENT
// username varchar(50)
// created_on timestamp
// action char(1)
// description varchar(300)
// visibility char(1)
type Activities struct {
Id int `sql:"AUTO_INCREMENT"`
Username string `sql:"varchar(50);unique"`
Created_On time.Time
Action string `sql:"type:char(1)"`
Description string `sql:"type:varchar(300)"`
Visibility string `sql:"type:char(1)"`
}
Instead of accessing the database via terminal to get the table structure, Gogland IDE has a wonderful database explorer feature that allow the software developer to explore the database without having to leave Gogland IDE.
To access the database... first, you need to configure the data source correctly with the proper username, URLs, password, port number by invoking View
->Tool Windows
->Database
or a slightly faster way if you need to add new data source into your project.
and proceed to add the new data source.
Since I'm using MariaDB instead of MySQL, the MySQL driver in Gogland can be used for accessing MariaDB as well.
For my own use, exploring the database to get some sample data and table structure is good enough. I'm sure there are other features as well that might be useful for you to explore and find out. :-)
NOTE: It is advisable to use a copy of database marked as development database for your engineering team to use. The worse thing that can happen is that a software developer accidentally erased some live data or dropped/altered a table structure and causing code error else well or .... destroy entire database.
Happy exploring and coding!
See also : Gogland : Single File versus Go Application Run Configurations
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+19.1k Golang : How to count the number of repeated characters in a string?
+7.6k Swift : Convert (cast) String to Double
+4.5k Fix Google Analytics Redundant Hostnames problem
+5.2k Golang : If else example and common mistake
+13.1k Golang : Read from buffered reader until specific number of bytes
+12.8k Golang : Calculate elapsed years or months since a date
+12.8k Golang : Skip blank/empty lines in CSV file and trim whitespaces example
+7k Golang : Of hash table and hash map
+17.3k Golang : Upload/Receive file progress indicator
+7.3k Golang : Convert(cast) io.Reader type to string
+29.5k Golang : How to get HTTP request header information?