Amalegeni-Go
 

Amalegeni-go (or amgo in short) is a code transliterator that makes it easy to combine go code and sql statements, with as main aim to write less code.

This quick example will make it clear. You write this..

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
type Detail struct {
    MasterId string
    Trackno int
    Title string
}


func SelectDetailMap() map[string] []Detail
<<
    select master_id as key,
           master_id,
           trackno,
           title
    from t_detail
    order by trackno
>>

.. then run amegeleni-go on it, which will turn it into valid go code, which in turn you call from your own go-code. For the above example, your code just calls the function SelectDetailMap(), and then works on the map of lists.

For other use cases, where you just want to do some data-massaging, or copying data from database to database, use the gq template which generates standalone go-code.

A little history

Amalegeni-go is based on the amalegeni java version, that you find here: accumulator.be/amalegeni

An example application

Have a look at Easy concurrent SQL with amalegeni-go and Go for a nice sample application of amalegeni-go, you'll be surprised how easy it is to write SQL to concurrently run on your sharded database

Step by step

Follow this detailed explanation about how to use amalegeni-go. Start with Example 1

Lessons learned

See some of the issues I encountered.. plus their solutions.

Work in progress

.. more to come..

 
© Willem Moors, 2013 - 2020