Skip to content

Instantly share code, notes, and snippets.

View oxlb's full-sized avatar
🎯
Focusing

Onexlab (Munish Kapoor) oxlb

🎯
Focusing
View GitHub Profile
@oxlb
oxlb / go.mod
Created October 9, 2020 15:41
go mod labstack
module github.com/oxlb/GoLangPostgresHelloWorld
go 1.14
require (
github.com/jinzhu/gorm v1.9.16
github.com/labstack/echo/v4 v4.1.17
gorm.io/gorm v1.20.2 // indirect
)
@oxlb
oxlb / student.go
Last active October 9, 2020 15:44
students
package model
type Students struct {
Id string `json:"id"`
Name string `json:"name"`
}
@oxlb
oxlb / db.go
Created October 9, 2020 15:52
storage
package storage
import (
"log"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/postgres"
config "github.com/oxlb/GoLangPostgresHelloWorld/config"
)
package controller
import (
"net/http"
"github.com/labstack/echo/v4"
"github.com/oxlb/GoLangPostgresHelloWorld/model"
"github.com/oxlb/GoLangPostgresHelloWorld/storage"
)
package main
import (
"net/http"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"github.com/oxlb/GoLangPostgresHelloWorld/controller"
"github.com/oxlb/GoLangPostgresHelloWorld/storage"
)
[
{
"id": "1",
"name": "A"
},
{
"id": "2",
"name": "B"
},
{
<script type="text/javascript" src="https://cdnjs.buymeacoffee.com/1.0.0/button.prod.min.js" data-name="bmc-button" data-slug="onexlab" data-color="#FFDD00" data-emoji="" data-font="Cookie" data-text="Buy us a coffee" data-outline-color="#000" data-font-color="#000" data-coffee-color="#fff" ></script>
@oxlb
oxlb / docker-compose.yml
Created October 14, 2020 02:45
docker compose mysql seed
version: '3.6'
services:
db:
image: mysql
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: mydb
@oxlb
oxlb / 01.sql
Created October 14, 2020 02:54
student records mysql
CREATE TABLE student (
id int,
name VARCHAR(255)
);
INSERT INTO student(id, name) VALUES
(1,'A'),
(2,'B'),
(3,'C');
'use strict';
module.exports.hello = async event => {
return {
statusCode: 200,
body: JSON.stringify(
{
message: 'Go Serverless v1.0! Your function executed successfully!',
input: event,
},