crud

command
v0.0.0-...-5c97d0a Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: Unlicense Imports: 5 Imported by: 0

README

Challange - Create CRUD using Golang

Tecnologies

  • MySQL
  • Golang

Requirements

Run command in the terminal for create container mysql:

docker run --name some-mysql \
-e MYSQL_PASSWORD={YOUR_PASSWORD} \
-e MYSQL_USER={YOUR_USER} \
-e MYSQL_DATABASE={YOUR_DATABASE} \
-d mysql:{VERSION}

Example:

docker run --name golang \
-e MYSQL_ROOT_PASSWORD=root_golang \
-e MYSQL_PASSWORD=golang \
-e MYSQL_USER=golang \
-e MYSQL_DATABASE=golang \
-d mysql:8.0.31

Use documentation to modify variabels:

  • YOUR_PASSWORD;
  • YOUR_USER;
  • YOUR_DATABASE;
  • VERSION.

Create table

Access container and execute command:

mysql -u golang -p
use golang
CREATE TABLE user(
    id int auto_increment primary key, 
    name varchar(50) not null,
    email varchar(50) not null) ENGINE=INNODB;

In the file db/db.go it's necessary modify variable stringConection with your credentials and IP.

Initialize modules

go mod init crud
go get github.com/gorilla/mux
go get github.com/go-sql-driver/mysql

Methods

Methods utilization in project:

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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