Conventions

GoSQL is very opinionated.

Tables

Table names are all snake case of the struct name and singular. type User struct{} will correspond to the table in the database named user. type UserProfile struct{} will correspond to the table in the database named user_profile.

Columns

Column names are all snake case of the struct field names. Consider the struct:

type User struct {
    ID       int `gosql:"primary"`
    Email    string
    IsActive bool
}

GoSQL expects the database to have a table named user with 3 columns: id, email, and is_active.

Last updated