示例#1
0
func ExampleContext_First() {
	type Person struct {
		// ...
	}

	ctx := rebecca.Context{Order: "age DESC"}
	oldestTeenager := &Person{}
	if err := ctx.First(oldestTeenager, "age < $1", 21); err != nil {
		panic(err)
	}
	// At this point oldestTeenager will contain a Person record that is of
	// maximum age and that is of age < 21.
	fmt.Print(oldestTeenager)
}