Simple Golang Fiber framework template
- Go >= 1.17
- RDB
- MariaDB or MySQL
- Redis
- If you don't wanna use query related things, comment out the lines in main.go that initializing DB connection
go-fiber
: main frameworkgo-fiber websocket
: websocketlogrus
: logger pkggorm
: go ORMgo-redis
: go Redisgodotenv
: to read and set .env variablesgoogle-uuid
: to generate uuidgolang-jwt
: JWTrobfig-cron
: cron (not used yet)
- DB / Redis settings (If you wanna use)
- generate
.env
file usingenv-sample
git clone https://github.com/vamos-onion/fiber-template.git
go mod tidy
&go run main.go
(or you can build the project and then run the binary executable file)
create table example
(
seq int(50) auto_increment
primary key,
payload varchar(50) default '' not null
);
create table organization
(
seq int(50) auto_increment
primary key,
organization varchar(50) not null,
org_uuid varchar(50) null,
status tinyint default 0 not null,
constraint organization_org_uuid_uindex
unique (org_uuid),
constraint organization_organization_uindex
unique (organization)
);
create table account
(
seq int unsigned auto_increment
primary key,
auth_seq int(50) not null,
account_id varchar(20) not null,
account_pwd varchar(100) not null,
account_name varchar(20) null,
account_email varchar(50) not null,
account_uuid varchar(40) not null,
status tinyint default 1 not null,
created_at datetime null,
updated_at datetime null,
connected_at datetime null,
constraint users_account_email_uindex
unique (account_email),
constraint users_account_id_uindex
unique (account_id),
constraint users_account_uuid_uindex
unique (account_uuid),
constraint account_organization_seq_fk
foreign key (auth_seq) references organization (seq)
);
logrus.Logger.SetReportCaller(true)
- only printing the point in
logger.go
file - if you want to print out original logrus report caller, should use logrus object directly
- only printing the point in
The packages that I used include MIT, BSD-2, and BSD-3 Licenses.
Please be aware of use it.