Documentation
¶
Index ¶
- Variables
- type Contact
- type Customer
- type CustomerRental
- type Info
- type Location
- type Movie
- type MovieRental
- type RootResolver
- type Store
- func (s Store) Customers() ([]Customer, error)
- func (s *Store) GetMovies(year int32, title string) ([]StoreMovie, error)
- func (s *Store) Init()
- func (s *Store) MakePK() string
- func (s *Store) MakeSK() string
- func (s Store) Movies(args struct{ ... }) ([]StoreMovie, error)
- func (s *Store) Put() error
- func (s Store) PutMovie(year int32, title string, count int32) error
- type StoreMovie
Constants ¶
This section is empty.
Variables ¶
View Source
var (
Schema = graphql.MustParseSchema(schemaString, &RootResolver{}, opts...)
)
Functions ¶
This section is empty.
Types ¶
type Customer ¶
type Customer struct {
PK string
SK string
GSI2PK string
Phone string // Customer's unique key.
StorePhone string // Foreign key to customer's store.
Contact Contact
}
func CustomerFromJSON ¶
func GetCustomer ¶
func (*Customer) MakeGSI2PK ¶
func (Customer) PutRental ¶
func (c Customer) PutRental() (CustomerRental, error)
type CustomerRental ¶
CustomerRental represents an occasion when the customer rented movies.
func (*CustomerRental) Init ¶
func (cr *CustomerRental) Init()
func (*CustomerRental) MakePK ¶
func (cr *CustomerRental) MakePK() string
func (*CustomerRental) MakeSK ¶
func (cr *CustomerRental) MakeSK() string
type Info ¶
type Info struct {
Directors []string
ReleaseDate time.Time `json:"release_date" dynamodbav:"ReleaseDate"`
Rating float64
Genres []string
ImageURL string `json:"image_url" dynamodbav:"ImageURL"`
Plot string
Rank int32
RunningTimeSecs int `json:"running_time_secs" dynamodbav:"RunningTimeSecs"`
Actors []string
}
type Movie ¶
func MovieFromJSON ¶
type MovieRental ¶
type MovieRental struct {
PK string
SK string
Year int32 // part of pkey to Movie
Title string // part of pkey to Movie
Phone string // Part of fkey to CustomerRental
Date time.Time // Part of fkey to CustomerRental
DueDate time.Time
ReturnDate time.Time
}
MovieRental represents a movie that was part of a CustomerRental
func (*MovieRental) Init ¶
func (mr *MovieRental) Init()
func (*MovieRental) MakePK ¶
func (mr *MovieRental) MakePK() string
func (*MovieRental) MakeSK ¶
func (mr *MovieRental) MakeSK() string
type RootResolver ¶
type RootResolver struct{}
func (*RootResolver) Customer ¶
func (r *RootResolver) Customer(args struct{ Phone string }) (Customer, error)
type Store ¶
func StoreFromJSON ¶
func (*Store) GetMovies ¶
func (s *Store) GetMovies(year int32, title string) ([]StoreMovie, error)
Movies returns the store's inventory. The year and title can be used to constrain the results, but because we apply this constraint to the sort key, the year must be specified, and if title is specied, any movie titles with that prefix will be returned. Obviously, this is only an exercise in DDB query techniques, and very much not a practical general-purpose search capability.
type StoreMovie ¶
type StoreMovie struct {
PK string
SK string
Phone string // Pkey to Store
Year int32 // Pkey to Movie
Title string // Pkey to Movie
Count int32
}
StoreMovie represents the copies of a movie in a store's inventory.
func (StoreMovie) GetMovie ¶
func (sm StoreMovie) GetMovie() (mov Movie, err error)
func (*StoreMovie) Init ¶
func (sm *StoreMovie) Init()
func (*StoreMovie) MakePK ¶
func (sm *StoreMovie) MakePK() string
func (*StoreMovie) MakeSK ¶
func (sm *StoreMovie) MakeSK() string
func (*StoreMovie) Put ¶
func (sm *StoreMovie) Put() error
Click to show internal directories.
Click to hide internal directories.