Documentation ¶
Index ¶
- Variables
- func DeleteUser(req events.APIGatewayProxyRequest, tableName string, ...) error
- func FetchUsers(tableName string, dynaClient dynamodbiface.DynamoDBAPI) (*[]User, error)
- type User
- func CreateUser(req events.APIGatewayProxyRequest, tableName string, ...) (*User, error)
- func FetchUser(id, tableName string, dynaClient dynamodbiface.DynamoDBAPI) (*User, error)
- func FetchUserByEmail(email, tableName string, dynaClient dynamodbiface.DynamoDBAPI) (*User, error)
- func UpdateUser(req events.APIGatewayProxyRequest, tableName string, ...) (*User, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrorFailedToUnmarshalRecord = "failed to unmarshal record" ErrorFailedToFetchRecord = "failed to fetch record" ErrorInvalidUserData = "invalid user data" ErrorInvalidEmail = "invalid email" ErrorCouldNotMarshalItem = "could not marshal item" ErrorCouldNotDeleteItem = "could not delete item" ErrorCouldNotDynamoPutItem = "could not dynamo put item" ErrorUserAlreadyExists = "user.User already exists" ErrorUserDoesNotExist = "user.User does not exist" ErrorUserAlreadyExist = "user.User already exists with same email" )
Functions ¶
func DeleteUser ¶
func DeleteUser(req events.APIGatewayProxyRequest, tableName string, dynaClient dynamodbiface.DynamoDBAPI) error
DeleteUser an existing user in dynamodb table
func FetchUsers ¶
func FetchUsers(tableName string, dynaClient dynamodbiface.DynamoDBAPI) (*[]User, error)
FetchUsers get all users from dynamodb
Types ¶
type User ¶
type User struct { Id string `json:"id"` Email string `json:"email"` FirstName string `json:"firstName"` LastName string `json:"lastName"` DateOfBirth string `json:"dob"` }
func CreateUser ¶
func CreateUser(req events.APIGatewayProxyRequest, tableName string, dynaClient dynamodbiface.DynamoDBAPI) ( *User, error, )
CreateUser inserts a new user into dynamodb table
func FetchUser ¶
func FetchUser(id, tableName string, dynaClient dynamodbiface.DynamoDBAPI) (*User, error)
FetchUser get single user from dynamodb by id primary key
func FetchUserByEmail ¶
func FetchUserByEmail(email, tableName string, dynaClient dynamodbiface.DynamoDBAPI) (*User, error)
FetchUserByEmail get single user from dynamodb by email index
func UpdateUser ¶
func UpdateUser(req events.APIGatewayProxyRequest, tableName string, dynaClient dynamodbiface.DynamoDBAPI) ( *User, error, )
UpdateUser update an existing user in dynamodb table
Click to show internal directories.
Click to hide internal directories.