gin

command module
v0.0.0-...-517f85e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2024 License: MIT Imports: 6 Imported by: 0

README

Using Make to Run Commands at a Glance

# apt-get -y install make

create Makefile

# touch Makefile

file structure:

command_name:
	command to run like cd ~

.PHONY: command_name

usage:

# make command_name

Powerfull tool to compile sql codes to go ORM

# snap install sqlc
# sqlc version
# sqlc init

sqlc.yaml config refrence:

https://docs.sqlc.dev/en/stable/reference/config.html

After creating migration files and query files, run this command to generate compiled Go files!

# sqlc generate

Installing Golang Viper for defining environment variables

https://github.com/spf13/viper

# go get github.com/spf13/viper

Install Gomock for mocking database in test mode

https://github.com/uber-go/mock

# go install go.uber.org/mock/mockgen@latest
# mockgen -version

if mockgen not defiend:

find mockgen path in your system:

# find / -name mockgen
"/home/docker/go/bin/mockgen"

# cp /home/docker/go/bin/mockgen /usr/local/bin/

use mock in db/sqlc/store.go add this to import

_ "github.com/golang/mock/mockgen/model"

then:

# go get go.uber.org/mock/mockgen/model

# mockgen -destination db/mock/store.go github.com/farshan-dev/gin/db/sqlc Store

read # mockgen -help for more info! i use Reflect mode in above command.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
db
mock
Package mockdb is a generated GoMock package.
Package mockdb is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL