Documentation ¶
Index ¶
- func CalcNewSize(width, height int, ratio float64) (int, int)
- func CreateNewFileName(fileName string, w, h int) string
- func CreateUploadPath(uploadPrefix, accountDir, fileName, date string) string
- func DeleteHandler(data Deleter, db *sql.DB) (err error)
- func DownloadFile(url, filePath string) (err error)
- func ForeignKeyUpdateHandler(data ForeignKeyUpdater, db *sql.DB) (err error)
- func GetFileName(url string) (string, string)
- func JoinCollectionContentUpsert(db *sql.DB, svUserId, collectionId, contentId string) (err error)
- func LoadValidateHandler(data LoaderValidator, fileBuffer *[]byte) (err error)
- func Md5Hasher(data []string) (out string)
- func PreProcessHandler(data PreProcessor, accountId string, db *sql.DB) (err error)
- func PutFile(c context.Context, api S3PutObjectAPI, input *s3.PutObjectInput) (*s3.PutObjectOutput, error)
- func RelatedTableUpsertHandler(data RelatedTableUpserter, accountId string, db *sql.DB) (err error)
- func ResizeBaseImage(decodedImg image.Image, w, h int) image.Image
- func ResizedImgHandler(i resizedImgHandler, accountId string, db *sql.DB) (err error)
- func UpsertHandler(data Upserter, accountId string, db *sql.DB) (err error)
- func ValidateUrl(url string) bool
- type Account
- type AccountNodes
- func (s *AccountNodes) Delete(db *sql.DB) (err error)
- func (s *AccountNodes) ForeignKeyUpdate(db *sql.DB) (err error)
- func (s *AccountNodes) Load(fileBuffer *[]byte) (err error)
- func (s *AccountNodes) RelatedTableUpsert(accountId string, db *sql.DB) (err error)
- func (s *AccountNodes) Upsert(accountId string, db *sql.DB) (err error)
- func (s *AccountNodes) Validate() (err error)
- type AllIdNodes
- type BaseData
- type BaseIdData
- type Collection
- type CollectionIdNodes
- type CollectionIds
- type CollectionNodes
- func (s *CollectionNodes) Delete(db *sql.DB) (err error)
- func (s *CollectionNodes) ForeignKeyUpdate(db *sql.DB) (err error)
- func (s *CollectionNodes) Load(fileBuffer *[]byte) (err error)
- func (s *CollectionNodes) RelatedTableUpsert(accountId string, db *sql.DB) (err error)
- func (s *CollectionNodes) Upsert(accountId string, db *sql.DB) (err error)
- func (s *CollectionNodes) Validate() (err error)
- type Content
- type ContentIdNodes
- type ContentIds
- type ContentNodes
- func (s *ContentNodes) Delete(db *sql.DB) (err error)
- func (s *ContentNodes) ForeignKeyUpdate(db *sql.DB) (err error)
- func (s *ContentNodes) Load(fileBuffer *[]byte) (err error)
- func (s *ContentNodes) RelatedTableUpsert(accountId string, db *sql.DB) (err error)
- func (s *ContentNodes) Upsert(accountId string, db *sql.DB) (err error)
- func (s *ContentNodes) Validate() (err error)
- type Deleter
- type ForeignKeyUpdater
- type Image
- func (s *Image) Construct(accountId string)
- func (s *Image) Download() (err error)
- func (s *Image) RecordValidate(record_id string, db *sql.DB) (exists int8, err error)
- func (s *Image) RemoveTempFile() (err error)
- func (s *Image) Resize() (err error)
- func (s *Image) ResizedImageUpsert(accountId string, db *sql.DB) (err error)
- func (s *Image) UploadToSpaces() (err error)
- type ImageIdNodes
- type ImageIds
- type ImageNodes
- func (s *ImageNodes) ForeignKeyUpdate(db *sql.DB) (err error)
- func (s *ImageNodes) Load(fileBuffer *[]byte) (err error)
- func (s *ImageNodes) PreProcess(accountId string, db *sql.DB) (err error)
- func (s *ImageNodes) RelatedTableUpsert(accountId string, db *sql.DB) (err error)
- func (s *ImageNodes) Upsert(accountId string, db *sql.DB) (err error)
- func (s *ImageNodes) Validate() (err error)
- type ImageProcessingInfo
- type ImgSize
- type Item
- type ItemIdNodes
- type ItemIds
- type ItemNodes
- func (s *ItemNodes) Delete(db *sql.DB) (err error)
- func (s *ItemNodes) ForeignKeyUpdate(db *sql.DB) (err error)
- func (s *ItemNodes) Load(fileBuffer *[]byte) (err error)
- func (s *ItemNodes) RelatedTableUpsert(accountId string, db *sql.DB) (err error)
- func (s *ItemNodes) Upsert(accountId string, db *sql.DB) (err error)
- func (s *ItemNodes) Validate() (err error)
- type JoinTable
- type LoaderValidator
- type Person
- type PersonIdNodes
- type PersonIds
- type PersonNodes
- func (s *PersonNodes) Delete(db *sql.DB) (err error)
- func (s *PersonNodes) ForeignKeyUpdate(db *sql.DB) (err error)
- func (s *PersonNodes) Load(fileBuffer *[]byte) (err error)
- func (s *PersonNodes) RelatedTableUpsert(accountId string, db *sql.DB) (err error)
- func (s *PersonNodes) Upsert(accountId string, db *sql.DB) (err error)
- func (s *PersonNodes) Validate() (err error)
- type Place
- type PlaceIdNodes
- type PlaceIds
- type PlaceNodes
- func (s *PlaceNodes) Delete(db *sql.DB) (err error)
- func (s *PlaceNodes) ForeignKeyUpdate(db *sql.DB) (err error)
- func (s *PlaceNodes) Load(fileBuffer *[]byte) (err error)
- func (s *PlaceNodes) RelatedTableUpsert(accountId string, db *sql.DB) (err error)
- func (s *PlaceNodes) Upsert(accountId string, db *sql.DB) (err error)
- func (s *PlaceNodes) Validate() (err error)
- type PreProcessor
- type RelatedTableUpserter
- type ResizedImage
- type S3PutObjectAPI
- type Upserter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateNewFileName ¶
func CreateUploadPath ¶
func DownloadFile ¶
func ForeignKeyUpdateHandler ¶
func ForeignKeyUpdateHandler(data ForeignKeyUpdater, db *sql.DB) (err error)
func GetFileName ¶
func LoadValidateHandler ¶
func LoadValidateHandler(data LoaderValidator, fileBuffer *[]byte) (err error)
func PreProcessHandler ¶
func PreProcessHandler(data PreProcessor, accountId string, db *sql.DB) (err error)
func PutFile ¶
func PutFile( c context.Context, api S3PutObjectAPI, input *s3.PutObjectInput) ( *s3.PutObjectOutput, error)
func RelatedTableUpsertHandler ¶
func RelatedTableUpsertHandler(data RelatedTableUpserter, accountId string, db *sql.DB) (err error)
func ResizedImgHandler ¶
func ValidateUrl ¶
Types ¶
type Account ¶
type Account struct { Id string `json:"id" validate:"required,uuid4"` ParentId string `json:"parentId" validate:"omitempty,uuid4"` Auth string `json:"auth" validate:"required,uuid4"` Key string `json:"key" validate:"required,uuid4"` Username string `json:"username" validate:"omitempty,gte=8,lte=100"` Firstname string `json:"firstname" validate:"omitempty,lte=100"` Lastname string `json:"lastname" validate:"omitempty,lte=100"` Nickname string `json:"nickname" validate:"omitempty,lte=100"` Document string }
type AccountNodes ¶
type AccountNodes struct { Nodes []*Account `json:"accountNodes" validate:"dive"` Gjson gjson.Result }
func (*AccountNodes) ForeignKeyUpdate ¶
func (s *AccountNodes) ForeignKeyUpdate(db *sql.DB) (err error)
func (*AccountNodes) Load ¶
func (s *AccountNodes) Load(fileBuffer *[]byte) (err error)
func (*AccountNodes) RelatedTableUpsert ¶
func (s *AccountNodes) RelatedTableUpsert(accountId string, db *sql.DB) (err error)
func (*AccountNodes) Upsert ¶
func (s *AccountNodes) Upsert(accountId string, db *sql.DB) (err error)
func (*AccountNodes) Validate ¶
func (s *AccountNodes) Validate() (err error)
type AllIdNodes ¶
type AllIdNodes struct { CollectionIdNodes ContentIdNodes ItemIdNodes ImageIdNodes PlaceIdNodes PersonIdNodes }
type BaseIdData ¶
type Collection ¶
type Collection struct { BaseData AllIdNodes }
type CollectionIdNodes ¶
type CollectionIdNodes struct { Nodes []CollectionIds `json:"collectionIdNodes" validate:"dive,omitempty"` // contains filtered or unexported fields }
type CollectionIds ¶
type CollectionIds struct {
BaseIdData
}
type CollectionNodes ¶
type CollectionNodes struct { Nodes []*Collection `json:"collectionNodes" validate:"dive"` Gjson gjson.Result }
func (*CollectionNodes) ForeignKeyUpdate ¶
func (s *CollectionNodes) ForeignKeyUpdate(db *sql.DB) (err error)
func (*CollectionNodes) Load ¶
func (s *CollectionNodes) Load(fileBuffer *[]byte) (err error)
func (*CollectionNodes) RelatedTableUpsert ¶
func (s *CollectionNodes) RelatedTableUpsert(accountId string, db *sql.DB) (err error)
func (*CollectionNodes) Upsert ¶
func (s *CollectionNodes) Upsert(accountId string, db *sql.DB) (err error)
func (*CollectionNodes) Validate ¶
func (s *CollectionNodes) Validate() (err error)
type Content ¶
type Content struct { BaseData AllIdNodes }
type ContentIdNodes ¶
type ContentIdNodes struct { Nodes []ContentIds `json:"contentIdNodes" validate:"dive,omitempty"` // contains filtered or unexported fields }
type ContentIds ¶
type ContentIds struct {
BaseIdData
}
type ContentNodes ¶
type ContentNodes struct { Nodes []*Content `json:"contentNodes" validate:"dive"` Gjson gjson.Result }
func (*ContentNodes) ForeignKeyUpdate ¶
func (s *ContentNodes) ForeignKeyUpdate(db *sql.DB) (err error)
func (*ContentNodes) Load ¶
func (s *ContentNodes) Load(fileBuffer *[]byte) (err error)
func (*ContentNodes) RelatedTableUpsert ¶
func (s *ContentNodes) RelatedTableUpsert(accountId string, db *sql.DB) (err error)
func (*ContentNodes) Upsert ¶
func (s *ContentNodes) Upsert(accountId string, db *sql.DB) (err error)
func (*ContentNodes) Validate ¶
func (s *ContentNodes) Validate() (err error)
type ForeignKeyUpdater ¶
type Image ¶
type Image struct { // Image struct differs from base data, it creates the id // from Md5Hasher of account_id, url. Note: the image.Url is required Id string `json:"id" validate:"omitempty"` ParentId string `json:"parentId" validate:"omitempty,uuid4"` Type string `json:"type" validate:"omitempty,lte=20"` AccountId string Document string AllIdNodes ImageProcessingInfo }
func (*Image) RecordValidate ¶
func (*Image) RemoveTempFile ¶
func (*Image) ResizedImageUpsert ¶
func (*Image) UploadToSpaces ¶
type ImageIdNodes ¶
type ImageIdNodes struct { Nodes []ImageIds `json:"imageIdNodes" validate:"dive,omitempty"` // contains filtered or unexported fields }
type ImageNodes ¶
func (*ImageNodes) ForeignKeyUpdate ¶
func (s *ImageNodes) ForeignKeyUpdate(db *sql.DB) (err error)
func (*ImageNodes) Load ¶
func (s *ImageNodes) Load(fileBuffer *[]byte) (err error)
func (*ImageNodes) PreProcess ¶
func (s *ImageNodes) PreProcess(accountId string, db *sql.DB) (err error)
func (*ImageNodes) RelatedTableUpsert ¶
func (s *ImageNodes) RelatedTableUpsert(accountId string, db *sql.DB) (err error)
func (*ImageNodes) Validate ¶
func (s *ImageNodes) Validate() (err error)
type ImageProcessingInfo ¶
type ImageProcessingInfo struct { Url string `json:"url" validate:"required,url"` Process uint8 `json:"process" validate:"omitempty,number,oneof=0 1"` TempFileDir string `json:"-"` // constructed :: location to download temp files UploadPrefix string `json:"-"` // constructed :: eg. "media" VanityUrl string `json:"-"` // constructed AccountDir string `json:"-"` // constructed :: eg. "98c56d78fe3a" Date string `json:"-"` // constructed :: eg. "2020-05-04" DoBucket string `json:"-"` // constructed DoCacheControl string `json:"-"` // constructed eg. "max-age=60" DoContentType string `json:"-"` // constructed eg. "image/webp" DoEndpointUrl string `json:"-"` // constructed DoAccessKey string `json:"-"` // constructed DoSecret string `json:"-"` // constructed DoRegionName string `json:"-"` // constructed BaseFileName string `json:"-"` ImgSizes []ImgSize `json:"-"` ResizedImages []ResizedImage `json:"-"` // contains filtered or unexported fields }
type Item ¶
type Item struct { BaseData AllIdNodes PlaceId string `json:"placeId" validate:"omitempty"` }
type ItemIdNodes ¶
type ItemIdNodes struct { Nodes []ItemIds `json:"itemIdNodes" validate:"dive,omitempty"` // contains filtered or unexported fields }
type ItemIds ¶
type ItemIds struct {
BaseIdData
}
type ItemNodes ¶
func (*ItemNodes) RelatedTableUpsert ¶
type JoinTable ¶
type JoinTable struct {
// contains filtered or unexported fields
}
func NewJoinTable ¶
type LoaderValidator ¶
type LoaderValidator interface {
// contains filtered or unexported methods
}
type Person ¶
type Person struct { BaseData AllIdNodes PlaceId string `json:"placeId" validate:"omitempty,uuid4"` }
type PersonIdNodes ¶
type PersonIdNodes struct { Nodes []PersonIds `json:"personIdNodes" validate:"dive,omitempty"` // contains filtered or unexported fields }
type PersonIds ¶
type PersonIds struct {
BaseIdData
}
type PersonNodes ¶
func (*PersonNodes) ForeignKeyUpdate ¶
func (s *PersonNodes) ForeignKeyUpdate(db *sql.DB) (err error)
func (*PersonNodes) Load ¶
func (s *PersonNodes) Load(fileBuffer *[]byte) (err error)
func (*PersonNodes) RelatedTableUpsert ¶
func (s *PersonNodes) RelatedTableUpsert(accountId string, db *sql.DB) (err error)
func (*PersonNodes) Validate ¶
func (s *PersonNodes) Validate() (err error)
type Place ¶
type Place struct { BaseData AllIdNodes }
type PlaceIdNodes ¶
type PlaceIdNodes struct { Nodes []PlaceIds `json:"placeIdNodes" validate:"dive,omitempty"` // contains filtered or unexported fields }
type PlaceIds ¶
type PlaceIds struct {
BaseIdData
}
type PlaceNodes ¶
func (*PlaceNodes) ForeignKeyUpdate ¶
func (s *PlaceNodes) ForeignKeyUpdate(db *sql.DB) (err error)
func (*PlaceNodes) Load ¶
func (s *PlaceNodes) Load(fileBuffer *[]byte) (err error)
func (*PlaceNodes) RelatedTableUpsert ¶
func (s *PlaceNodes) RelatedTableUpsert(accountId string, db *sql.DB) (err error)
func (*PlaceNodes) Validate ¶
func (s *PlaceNodes) Validate() (err error)
type PreProcessor ¶
type RelatedTableUpserter ¶
type ResizedImage ¶
type ResizedImage struct {
// contains filtered or unexported fields
}
type S3PutObjectAPI ¶
type S3PutObjectAPI interface { PutObject(ctx context.Context, params *s3.PutObjectInput, optFns ...func(*s3.Options)) (*s3.PutObjectOutput, error) }
S3PutObjectAPI defines the interface for the PutObject function. We use this interface to test the function using a mocked service.
Click to show internal directories.
Click to hide internal directories.