Documentation ¶
Overview ¶
Package awsdynamo implements `posty/model` persistence for the aws dynamodb database
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DynamoModel ¶
type DynamoModel struct {
// contains filtered or unexported fields
}
DynamoModel implements `posty/model` for the dynamodb
func NewModelFromSession ¶
func NewModelFromSession(s *session.Session) *DynamoModel
NewModelFromSession creates an new Model from an aws session.
func (*DynamoModel) PostPeer ¶
func (m *DynamoModel) PostPeer() model.PostPeer
PostPeer returns the dynamodb PostPeer associated with the model
func (*DynamoModel) UserPeer ¶
func (m *DynamoModel) UserPeer() model.UserPeer
UserPeer returns the dynamodb UserPeer associated with the model
type DynamoPostPeer ¶
type DynamoPostPeer struct {
// contains filtered or unexported fields
}
DynamoPostPeer defines interaction with the post data backed by dynamodb.
func (*DynamoPostPeer) GetByID ¶
func (pp *DynamoPostPeer) GetByID(id string) (*model.Post, error)
GetByID fetches the post identified by the id primary hash key. Otherwise an error is returned.
func (*DynamoPostPeer) GetPosts ¶
func (pp *DynamoPostPeer) GetPosts() ([]*model.Post, error)
GetPosts returns all posts from the database.
func (*DynamoPostPeer) NewPost ¶
func (pp *DynamoPostPeer) NewPost(uid string) *model.Post
NewPost creates a new post associated with a given user id. The post is not inserted into the database until it is saved.
type DynamoUserPeer ¶
type DynamoUserPeer struct {
// contains filtered or unexported fields
}
DynamoUserPeer defines interaction with the post data backed by dynamodb.
func (*DynamoUserPeer) GetByID ¶
func (p *DynamoUserPeer) GetByID(ID string) (*model.User, error)
GetByID fetches a single user identified by the unique id. Otherwise an error is returned.
func (*DynamoUserPeer) GetByOAuthID ¶
func (p *DynamoUserPeer) GetByOAuthID(ID string) (*model.User, error)
GetByOAuthID returns a single user identified by the oauth id. Otherwise an error is returned.
func (*DynamoUserPeer) NewUser ¶
func (p *DynamoUserPeer) NewUser() *model.User
NewUser creates a new user. The object is not saved to the database.
func (*DynamoUserPeer) SaveNew ¶
func (p *DynamoUserPeer) SaveNew(u *model.User) error
SaveNew saves a newly created user to the database.
func (*DynamoUserPeer) UpdateLastLogin ¶
func (p *DynamoUserPeer) UpdateLastLogin(id string) error
UpdateLastLogin updates the timestamp of the last login of the user identified by the given user id.
Directories ¶
Path | Synopsis |
---|---|
Package integrationtest provides tests interacting with a dynamodb endpoint.
|
Package integrationtest provides tests interacting with a dynamodb endpoint. |