Skip to content

Instantly share code, notes, and snippets.

//go:build ignore
// +build ignore
package main
import (
"entgo.io/ent/entc"
"entgo.io/ent/entc/gen"
"log"
)
package datastore
import (
"entgo.io/ent/dialect"
"github.com/go-sql-driver/mysql"
"planetscale-witn-ent/config"
"planetscale-witn-ent/ent"
)
// New returns data source name
package main
import (
"context"
"log"
"planetscale-witn-ent/config"
"planetscale-witn-ent/datastore"
"planetscale-witn-ent/ent"
"planetscale-witn-ent/ent/migrate"
)
appEnv: staging
database:
user: zwol6dt8f5hl
password: your password
net: tcp
addr: fzqo67lk4imj.ap-northeast-2.psdb.cloud
dbname: planet-ent-example
allowNativePasswords: true
params:
package config
import (
"fmt"
"log"
"os"
"path"
"path/filepath"
"runtime"
expect.POST(router.QueryPath).WithJSON(map[string]string{
"query": `
mutation {
createUser(input: {name: "Tom1", age: 20}) {
age
name
id
createdAt
updatedAt
}
package repository_test
import (
"context"
"golang-clean-architecture-ent-gqlgen/ent"
"golang-clean-architecture-ent-gqlgen/pkg/adapter/repository"
"golang-clean-architecture-ent-gqlgen/pkg/entity/model"
"golang-clean-architecture-ent-gqlgen/testutil"
"testing"
package testutil
import (
"context"
"golang-clean-architecture-ent-gqlgen/ent"
"golang-clean-architecture-ent-gqlgen/ent/enttest"
"golang-clean-architecture-ent-gqlgen/pkg/infrastructure/datastore"
"testing"
"entgo.io/ent/dialect"
package testutil
import (
"golang-clean-architecture-ent-gqlgen/config"
"golang-clean-architecture-ent-gqlgen/pkg/util/environment"
)
// ReadConfig reads config file for test.
func ReadConfig() {
config.ReadConfig(config.ReadConfigOption{
#!/bin/bash
cd docker || exit
docker compose cp ./mysql_data/sql mysql:/var/lib/mysql/
docker compose exec mysql bash -c "mysql -uroot -proot < /var/lib/mysql/sql/reset_database.test.sql"