Documentation ¶
Index ¶
- Constants
- func DecodeCursor(cursor string) (*todoCursor, error)
- type Error
- type InMemoryTodoRepository
- func (r *InMemoryTodoRepository) Delete(ids []string) (errors []error)
- func (r *InMemoryTodoRepository) GetTodos() (todos []*TodoItem, err error)
- func (r *InMemoryTodoRepository) GetTodosById(ids []string) (todos []*TodoItem, errors []error)
- func (r *InMemoryTodoRepository) Upsert(items []*TodoItem) (todos []*TodoItem, errors []error)
- type NullableID
- type TodoItem
- type TodoRepository
Constants ¶
View Source
const (
ErrNotFound = Error("could not find the item you were looking for")
)
Variables ¶
This section is empty.
Functions ¶
func DecodeCursor ¶
Types ¶
type InMemoryTodoRepository ¶
type InMemoryTodoRepository struct {
// contains filtered or unexported fields
}
InMemoryTodoRepository - for in-mem hackery...
func (*InMemoryTodoRepository) Delete ¶
func (r *InMemoryTodoRepository) Delete(ids []string) (errors []error)
func (*InMemoryTodoRepository) GetTodos ¶
func (r *InMemoryTodoRepository) GetTodos() (todos []*TodoItem, err error)
func (*InMemoryTodoRepository) GetTodosById ¶
func (r *InMemoryTodoRepository) GetTodosById(ids []string) (todos []*TodoItem, errors []error)
type NullableID ¶
type NullableID struct {
Value string
}
type TodoItem ¶
type TodoItem struct { ID *NullableID // shenanigans to allow for null ID... some other mechanism would likely be more appropriate for a "real" store. Text string Done bool UserID string }
func (*TodoItem) EncodeCursor ¶
type TodoRepository ¶
type TodoRepository interface { GetTodos() (todos []*TodoItem, err error) GetTodosById(ids []string) (todos []*TodoItem, errors []error) Upsert(items []*TodoItem) (todos []*TodoItem, errors []error) Delete(ids []string) (errors []error) }
TodoRepository stuff... ... PoCing a "repository" pattern integrated with DataLoader pattern, and demonstrating that persistence model != graphql schema model (hence there's a TodoItem struct here that is the repository's type for TODOs... which is separate from the graph.model.Todo)
func NewInMemoryTodoRepository ¶
func NewInMemoryTodoRepository() TodoRepository
Click to show internal directories.
Click to hide internal directories.