Facebook Pixel

Go, Revel and MySQL Integration Template

This example shows how to use AnyChart library with the Go programming language, Revel web framework and MySQL database.
View on GitHub

Running

To use this sample you must have Go installed as described here, and follow the official Go code organization; MySQL installed and running, if not please check out MySQL download page and follow these instructions.

To check your installations, run the following command in the command line:


$ go version
go version go1.7.1 linux/amd64 # sample output
$ mysql --version
mysql  Ver 14.14 Distrib 5.5.52, for debian-linux-gnu (x86_64) using readline 6. # sample output
                  

To start this example run commands listed below.

Install Revel:


$ go get github.com/revel/cmd/revel
                    

Clone the repository from github.com:


$ go get github.com/anychart-integrations/golang-revel-mysql-template
                    

Navigate to the repository folder:


$ cd $GOPATH/src/github.com/anychart-integrations/golang-revel-mysql-template
                    

Get dependencies:


$ go get ./...
                    

Set up MySQL database, use -u -p flags to provide username and password:


$  mysql < database_backup.sql
                    

Run example:


$ revel run github.com/anychart-integrations/golang-revel-mysql-template
                    

Open browser at http://localhost:9000/


Workspace

Your workspace should look like:


$GOPATH/
    bin/
    pkg/
    src/
        github.com/
            {user}/
                golang-revel-mysql-template/
                    app/
                        controllers/
                            app.go      # main index controller
                            gorp.go     # database controller
                            init.go     # init contoller
                        models/
                            fruit.go    # model for data
                        routes/
                            routes.go   # revel auto-generated file for routes processing
                        tmp/
                            main.go     # revel auto-generated file
                        views/
                            App/
                                index.html  # template for chart render
                            errors
                                404.html
                                500.html
                            debug.html
                            flash.html
                            footer.html
                            header.html
                        init.go         # revel auto-generated init file
                    conf/
                        app.conf        # revel main configuration file
                        routes          # app routes definition
                    messages/
                        sample.en       # revel i18n
                    public/             # public assets
                        css/
                            style.css   # css file
                        fonts/
                        img/
                        js/
                    tests/              # test suites
                    .gitignore
                    database_backup.sql     # MySQL database dump
                    LICENSE
                    README.md
                    

Technologies


Further Learning


License

AnyChart Go/Revel/MySQL integration sample includes two parts:

  • Code of the integration sample that allows to use Javascript library (in this case, AnyChart) with Revel framework, Go language and MySQL database. You can use, edit, modify it, use it with other Javascript libraries without any restrictions. It is released under Apache 2.0 License.
  • AnyChart JavaScript library. It is released under Commercial license. You can test this plugin with the trial version of AnyChart. Our trial version is not limited by time and doesn't contain any feature limitations. Check details here.

If you have any questions regarding licensing - please contact us. sales@anychart.com