Documentation ¶
Index ¶
- Constants
- func GetClientContext() (*mongo.Client, context.Context, context.CancelFunc)
- func MakeResponse(obj interface{}, StatusCode int) (events.APIGatewayProxyResponse, error)
- func Marshal(entity interface{}) string
- func ParseBody[T any](body string) (*T, error)
- func ParseResponseBody(resp events.APIGatewayProxyResponse) (map[string]interface{}, error)
- type COLLECTION_NAME
- type Datetime
- type FUNCTION_NAME
- type Note
- type Queues
- type ResponseBodyType
Constants ¶
View Source
const ( FUN_CREATE_NOTE FUNCTION_NAME = "create_note" FUN_READ_NOTE = "read_note" FUN_DELETE_NOTE = "delete_note" )
Variables ¶
This section is empty.
Functions ¶
func GetClientContext ¶
func MakeResponse ¶
func MakeResponse(obj interface{}, StatusCode int) (events.APIGatewayProxyResponse, error)
MakeResponse returns a response with the given body and status code.
func ParseResponseBody ¶
func ParseResponseBody(resp events.APIGatewayProxyResponse) (map[string]interface{}, error)
Types ¶
type COLLECTION_NAME ¶
type COLLECTION_NAME string
const ( // COL_NOTES is the name of the collection that stores notes. COL_NOTES COLLECTION_NAME = "notes" )
type Datetime ¶
func GetDateTimeNow ¶
func GetDateTimeNow() Datetime
GetDateTime returns the current date time in the format YYYY-MM-DD HH:MM:SS
func (*Datetime) UnmarshalJSON ¶
UnmarshalJSON parse isoformat date
type FUNCTION_NAME ¶
type FUNCTION_NAME string
type Note ¶
type Note struct { Id primitive.ObjectID `json:"id" bson:"_id"` URL string `json:"url"` Message string `json:"message" validate:"min=1,max=140"` Password string `json:"password"` ExpireAt Datetime `json:"expireAt" bson:"expireAt"` CreatedAt Datetime `json:"createdAt"` }
func (*Note) DecryptMessage ¶
func (*Note) EncryptMessage ¶
EncryptMessage encrypts the message with random key and return the key
func (*Note) GenerateUrl ¶
generate and set note URL
func (*Note) GetCollectionName ¶
GetCollection returns the collection name for the given entity
type ResponseBodyType ¶
type ResponseBodyType map[string]interface{}
Click to show internal directories.
Click to hide internal directories.