Files
ent/entc/integration/migrate/entv1/example_test.go
Alex Snast b71ee6820b ent/schema: remove string field charset / collation settings
Summary: don't expose starage specific features in ent schema

Reviewed By: a8m

Differential Revision: D17111724

fbshipit-source-id: fca9e624b272c0db3fed14c511fa6cb07816a100
2019-08-29 07:38:39 -07:00

44 lines
847 B
Go

// Code generated (@generated) by entc, DO NOT EDIT.
package entv1
import (
"context"
"log"
"github.com/facebookincubator/ent/dialect/sql"
)
// dsn for the database. In order to run the tests locally, run the following command:
//
// ENTV1_INTEGRATION_ENDPOINT="root:pass@tcp(localhost:3306)/test?parseTime=True" go test -v
//
var dsn string
func ExampleUser() {
if dsn == "" {
return
}
ctx := context.Background()
drv, err := sql.Open("mysql", dsn)
if err != nil {
log.Fatalf("failed creating database client: %v", err)
}
defer drv.Close()
client := NewClient(Driver(drv))
// creating vertices for the user's edges.
// create user vertex with its edges.
u := client.User.
Create().
SetAge(1).
SetName("string").
SetAddress("string").
SaveX(ctx)
log.Println("user created:", u)
// query edges.
// Output:
}