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
+6.5k Fix sudo yum hang problem with no output or error messages
+11.2k SSL : The certificate is not trusted because no issuer chain was provided
+14.2k Golang : Find commonalities in two slices or arrays example
+11.8k Golang : Display list of countries and ISO codes
+6.3k Golang : Humanize and Titleize functions
+10.5k Golang : How to transmit update file to client by HTTP request example
+3.3k Java : Get FX sentiment from website example
+16.1k Golang : How to implement two-factor authentication?
+17k Golang : Find smallest number in array
+6.1k Grep : How to grep for strings inside binary data