FAQ Database Discussion Community

How to set default value for a column on CreateTables()?

I am using gorp, and I want to create a table with DbMap#CreateTables() by setting a default value for a column. How can I achieve this?...

Encode array to base64 in go

Here is my complete code for a function I develop: package main import ( "database/sql" "log" "encoding/xml" "github.com/gin-gonic/gin" //golang frameworks _ "github.com/go-sql-driver/mysql" "gopkg.in/gorp.v1" //work with database(mysql, etc.) ) type Genre struct { Title string `xml:"genre"` } type GenreArray struct { Auth_state int `xml:"auth_state"` Count int64 `xml:"count"` Item genreAPI `xml:"item"` }...