Use ent by defining your schema in Go structs, generating the code with entc, and then using the generated client to query your database.
// 1. Define schema in schema/user.go
type User struct {
ent.Schema
}
func (User) Fields() []ent.Field {
return []ent.Field{
field.String("name"),
}
}
// 2. Generate code: entc generate
// 3. Use in main.go
client, _ := ent.Open("sqlite3", "file:ent?mode=memory")
user, _ := client.User.Create().SetName("Alice").Save(ctx)
_ = user.Name