Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/danisbagus/shopping-cart-api

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/danisbagus/shopping-cart-api

  • v0.0.0-20220904075013-2dc0bcd64bcc
  • Source
  • Go
  • Socket score

Version published
Created
Source

shopping-cart-api

Shopping Cart API

Requirements

  • Golang as main programming language.
  • Go Module for package management.
  • Goose as migration tool.
  • Postgresql as database driver.
  • Docker-compose for running database container locally.
  • Mockery for generate mockup object

Setup

Prepare necessary environment by rename .env.example to .env

Run database container

docker-compose up

Run the App

Get packages

go get .

Delete unused packages if necessary

go mod tidy

Update package vendor

go mod vendor

Build the app

go build -o bin/shopping-cart -v .

Run the App

./bin/shopping-cart 

Migration

Create new migration

go run app/migration/psql/main.go create AddSomeColumns

Up migration

go run app/migration/psql/main.go up

Down migration

go run app/migration/psql/main.go down

Check migration status

go run app/migration/psql/main.go status

Mockup

Generate mock

mockery --name=[interface name] --dir=[directory of interface] --output=[directory to write mocks] --filename=[name of generated file] --outpkg=[name of generated package] --structname=[name of generated struct]

mockery --name=UserRepo --dir=./core/port/ --output=./infrastructure/repo/mock/user --filename=repo.go --outpkg=user --structname=Repo

Unit Test

Run unit test

go test -v ./...

Run unit test specific function

go test -v -run TestProductCategory_Create_Success

Check coverage

go test -cover ./...

Generate coverage

go test -coverprofile=coverage ./... 

FAQs

Package last updated on 04 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc