This file contains hidden or 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
const socket = new WebSocket("wss://xxxx.xxxx.ap-northeast-1.cs.amazonlightsail.com/ws"); |
This file contains hidden or 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 golang:1.18-alpine as build | |
ENV GO111MODULE=on \ | |
CGO_ENABLED=0 \ | |
GOOS=linux \ | |
GOARCH=amd64 | |
WORKDIR /go/src | |
COPY . . |
This file contains hidden or 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
# Deployment | |
export image := `aws lightsail get-container-images --service-name websocket-lightsail | jq -r '.containerImages[0].image'` | |
build: | |
docker rmi app | |
docker build . -t app | |
push: | |
aws lightsail push-container-image --service-name websocket-lightsail --label app --image app |
This file contains hidden or 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 ( | |
"planetscale-witn-ent/cmd/seed/seed" | |
"planetscale-witn-ent/config" | |
) | |
func main() { | |
config.ReadConfig(config.ReadConfigOption{}) | |
seed.Seed() |
This file contains hidden or 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 seed | |
import ( | |
"context" | |
"log" | |
"planetscale-witn-ent/datastore" | |
"planetscale-witn-ent/ent" | |
) | |
// Seed truncate table and generates new data. |
This file contains hidden or 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 seed | |
import ( | |
"context" | |
"log" | |
"planetscale-witn-ent/ent" | |
) | |
// User generates user data. | |
func User(ctx context.Context, client *ent.Client) { |
This file contains hidden or 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
// CreateUserInput represents a mutation input for creating users. | |
type CreateUserInput struct { | |
Name string | |
Age int | |
CreatedAt *time.Time | |
UpdatedAt *time.Time | |
} | |
// UpdateUserInput represents a mutation input for updating users. | |
type UpdateUserInput struct { | |
ID int |
This file contains hidden or 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
{{ define "external" }} | |
package ent | |
import ( | |
"database/sql" | |
"log" | |
entsql "entgo.io/ent/dialect/sql" | |
) |
This file contains hidden or 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
{{ define "mutation_input" }} | |
{{- /*gotype: entgo.io/ent/entc/gen.Graph*/ -}} | |
{{ $pkg := base $.Config.Package }} | |
{{- with extend $ "Package" $pkg }} | |
{{ template "header" . }} | |
{{- end }} | |
{{ template "import" $ }} |
This file contains hidden or 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 ent | |
//go:generate go run -mod=mod entc.go |