This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"database/sql" | |
"encoding/json" | |
"fmt" | |
"log" | |
"time" | |
"github.com/go-sql-driver/mysql" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"database/sql" | |
"encoding/json" | |
"fmt" | |
"reflect" | |
"time" | |
"github.com/go-sql-driver/mysql" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.conf import settings | |
from django.db import models | |
from django.contrib.auth.models import AbstractUser | |
from django.utils.translation import ugettext_lazy as _ | |
from enumfields import EnumField | |
from enumfields import Enum | |
class SystemUserRole(Enum): | |
SYS_ADMIN = "SYS_ADMIN" | |
SYS_USER = "SYS_USER" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rest_framework import serializers | |
from enumfields.drf.serializers import EnumSupportSerializerMixin | |
from .models import User, Company | |
class CompanySerializer(serializers.ModelSerializer): | |
full_address = serializers.CharField(read_only=True) | |
class Meta: | |
model = Company |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GetSerializerClassMixin(object): | |
def get_serializer_class(self): | |
""" | |
A class which inhertis this mixins should have variable | |
`serializer_action_classes`. | |
Look for serializer class in self.serializer_action_classes, which | |
should be a dict mapping action name (key) to serializer class (value), | |
i.e.: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rest_framework import viewsets | |
from .mixins import GetSerializerClassMixin | |
from .models import User, Company, SystemUserRole | |
from .serializers import ( | |
CompanySerializer, | |
CompanyDetailSerializer, | |
UserSerializer, | |
UserDetailSerializer, | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
go-mysql-json-ex/ | |
|-- dbm/ // contains all database related operations | |
| |-- internal/ // internal only accessible to dbm | |
| | |-- base.go // contains db conf, manager | |
| | |-- prepsql.go // all prepared statements used in entire app | |
| |-- conn.go // db init, close API call | |
| |-- delete.go // delete db resource APIs | |
| |-- get.go // get db resource APIs | |
| |-- insert.go // insert db resource APIs | |
| |-- models.go // models in go representing db tables structrure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rest_framework import viewsets | |
from .mixins import GetSerializerClassMixin | |
from .models import User, Company, SystemUserRole | |
from .serializers import ( | |
CompanySerializer, | |
CompanyDetailSerializer, | |
UserSerializer, | |
UserDetailSerializer, | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mysql.connector | |
import json | |
config = { | |
"user": "", | |
"password": "", | |
"host": "localhost", | |
"database": "test", | |
"use_pure": True, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script installs the dependencies required by cypress.io tool | |
# on amazon linux AMI as the required dependencies are not easily available. | |
# path of dynamic executable of cypress | |
# for ex. /home/ec2-user/.cache/Cypress/3.0.1/Cypress/ | |
CYPRESS_EXECUTABLE_FOLDER="/home/ec2-user/.cache/Cypress/<version>/Cypress" | |
exitError() { |
NewerOlder