-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
538 additions
and
12 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
sqlboiler | ||
docs | ||
models | ||
sample/docs/dbschema.md | ||
models | ||
sample/mysql/data |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# syntax = docker/dockerfile:1.0-experimental | ||
|
||
FROM golang:1.14.4-alpine AS build | ||
|
||
RUN --mount=type=cache,target=/var/cache/apk apk add --update git | ||
|
||
WORKDIR /go/src/github.com/titech-cpp/sqlboiler/sample | ||
COPY go.* ./ | ||
RUN go mod download | ||
|
||
COPY ./ ./ | ||
RUN --mount=type=cache,target=/root/.cache/go-build \ | ||
go build -o main -ldflags "-s -w" | ||
|
||
FROM alpine:3.11.6 AS runtime | ||
|
||
ENV DOCKERIZE_VERSION v0.6.1 | ||
RUN apk add --update tzdata && \ | ||
cp /usr/share/zoneinfo/Asia/Tokyo /Tokyo && \ | ||
apk del tzdata && \ | ||
rm -rf /var/cache/apk/* && \ | ||
mkdir -p /usr/share/zoneinfo/Asia && \ | ||
mv /Tokyo /usr/share/zoneinfo/Asia | ||
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz && \ | ||
tar -C /usr/local/bin -xzvf dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz && \ | ||
rm dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz | ||
|
||
COPY --from=build /go/src/github.com/titech-cpp/sqlboiler/sample/main ./ | ||
|
||
ENTRYPOINT dockerize -wait tcp://mariadb:3306 ./main |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
version: "3" | ||
services: | ||
server: | ||
build: | ||
context: ./ | ||
dockerfile: ./Dockerfile | ||
environment: | ||
DB_USERNAME: root | ||
DB_PASSWORD: pass | ||
DB_HOSTNAME: mariadb | ||
DB_PORT: 3306 | ||
DB_DATABASE: sqlboiler_sample | ||
mariadb: | ||
image: mariadb:10.5.2 | ||
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci | ||
environment: | ||
MYSQL_ROOT_PASSWORD: pass | ||
volumes: | ||
- ./mysql/init:/docker-entrypoint-initdb.d | ||
- ./mysql/data:/var/lib/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
db: | ||
type: mysql | ||
name: twitter-clone | ||
tables: | ||
users: | ||
- name: id | ||
type: int(11) | ||
auto_increment: true | ||
key: PRI | ||
- name: name | ||
type: varchar(32) | ||
null: false | ||
- name: password | ||
type: char(128) | ||
null: false | ||
- name: created_at | ||
type: datetime(6) | ||
default: CURRENT_TIMESTAMP | ||
null: false | ||
- name: updated_at | ||
type: datetime(6) | ||
default: CURRENT_TIMESTAMP | ||
null: false | ||
messages: | ||
- name: id | ||
type: varchar(36) | ||
key: PRI | ||
- name: user_id | ||
type: int(11) | ||
null: false | ||
foreign_key: | ||
users: id | ||
- name: content | ||
type: text | ||
null: false | ||
- name: is_pinned | ||
type: boolean | ||
null: false | ||
default: false | ||
- name: created_at | ||
type: datetime(6) | ||
default: CURRENT_TIMESTAMP | ||
null: false | ||
- name: updated_at | ||
type: datetime(6) | ||
default: null | ||
- name: deleted_at | ||
type: datetime(6) | ||
default: null | ||
follow: | ||
- name: id | ||
type: int(11) | ||
auto_increment: true | ||
key: PRI | ||
- name: user_id | ||
type: int(11) | ||
null: false | ||
foreign_key: | ||
users: id | ||
- name: target_user_id | ||
type: int(11) | ||
null: false | ||
foreign_key: | ||
users: id | ||
- name: created_at | ||
type: datetime(6) | ||
default: CURRENT_TIMESTAMP | ||
null: false | ||
- name: deleted_at | ||
type: datetime(6) | ||
default: null | ||
favorite: | ||
- name: id | ||
type: int(11) | ||
auto_increment: true | ||
key: PRI | ||
- name: user_id | ||
type: int(11) | ||
null: false | ||
foreign_key: | ||
users: id | ||
- name: target_message_id | ||
type: varchar(36) | ||
null: false | ||
- name: created_at | ||
type: datetime(6) | ||
default: CURRENT_TIMESTAMP | ||
null: false | ||
- name: deleted_at | ||
type: datetime(6) | ||
default: null |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module github.com/titech-cpp/sqlboiler/sample | ||
|
||
go 1.14 | ||
|
||
require ( | ||
github.com/go-sql-driver/mysql v1.5.0 | ||
github.com/titech-cpp/sqlboiler v0.0.0-20200611063416-78e1dbca601c | ||
) |
Oops, something went wrong.