Skip to content

Instantly share code, notes, and snippets.

const socket = new WebSocket("wss://xxxx.xxxx.ap-northeast-1.cs.amazonlightsail.com/ws");
FROM golang:1.18-alpine as build
ENV GO111MODULE=on \
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64
WORKDIR /go/src
COPY . .
# 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
package main
import (
"planetscale-witn-ent/cmd/seed/seed"
"planetscale-witn-ent/config"
)
func main() {
config.ReadConfig(config.ReadConfigOption{})
seed.Seed()
package seed
import (
"context"
"log"
"planetscale-witn-ent/datastore"
"planetscale-witn-ent/ent"
)
// Seed truncate table and generates new data.
package seed
import (
"context"
"log"
"planetscale-witn-ent/ent"
)
// User generates user data.
func User(ctx context.Context, client *ent.Client) {
// 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
{{ define "external" }}
package ent
import (
"database/sql"
"log"
entsql "entgo.io/ent/dialect/sql"
)
{{ define "mutation_input" }}
{{- /*gotype: entgo.io/ent/entc/gen.Graph*/ -}}
{{ $pkg := base $.Config.Package }}
{{- with extend $ "Package" $pkg }}
{{ template "header" . }}
{{- end }}
{{ template "import" $ }}
package ent
//go:generate go run -mod=mod entc.go