Documentation ¶
Index ¶
- Constants
- Variables
- func DecodeHash(hash string) (int64, error)
- func Encrypt(toEncrypt string, salt []byte) (string, error)
- func GenImage(id uint64) *image.RGBA
- func GenKey() string
- func GetCloudRepo() string
- func GetEmailHost() string
- func GetEmailPasswd() string
- func GetEncKey() string
- func GetOrigins() []string
- func GetPkgRepo() string
- func GetPkgURL() string
- func GetTokenKey() string
- func GetTokenLifetime() int
- func HashID(id int64) (string, error)
- func LoadDB()
- type Filter
- type ID
- type NullInt64
- type NullString
- type NullTime
- type Option
- type Query
- type SQLPatch
- type Sort
- type Storage
- func (s *Storage) BulkDeleteFiles()
- func (s *Storage) CopyAndStoreFile(userID string, objID string, prevVersion string, version string, ...)
- func (s *Storage) DeleteFile(userID string, objID string, version string, filename string)
- func (s *Storage) Error() error
- func (s *Storage) GetFileContent(userID string, objID string, version string, filename string) string
- func (s *Storage) GetPathFor(userID string, objID string, version string, filename string) string
- func (s *Storage) PushBulkFile(userID string, objID string, version string, filename string)
- func (s *Storage) SetSource(src string)
- func (s *Storage) StoreFile(content interface{}, contentType string, userID string, objID string, ...) string
- type StringSlice
- type UintSlice
Constants ¶
const ( CREATED_AT = "createdAt" CREATOR = "creator" SEARCH = "search" NB_USE = "nbUse" )
Filters and orders
const ( SrcCreations string = "creations" SrcPackages string = "packages" SrcPreview string = "previews" SrcProfile string = "profiles" SrcCreaThumb string = "crea_thumb" )
AWS S3 storage locations
Variables ¶
var DB *sqlx.DB
DB driver
Functions ¶
Types ¶
type ID ¶
ID is a custom type for hashed IDs
func (*ID) UnmarshalJSON ¶
UnmarshalJSON unmarshals custom NullString
type NullInt64 ¶
NullInt64 is psql null for string
func InitNullInt64 ¶
InitNullInt64 returns a NullInt64 with int64 "val"
func (NullInt64) MarshalJSON ¶
MarshalJSON marshals custom NullString
func (*NullInt64) UnmarshalJSON ¶
UnmarshalJSON unmarshals custom NullInt64
type NullString ¶
type NullString struct {
sql.NullString
}
NullString is psql null for string
func InitNullString ¶
func InitNullString(str string) *NullString
InitNullString returns a NullString with String "str"
func (NullString) MarshalJSON ¶
func (ns NullString) MarshalJSON() ([]byte, error)
MarshalJSON marshals custom NullString
type NullTime ¶
NullTime is psql null for time.Time
func InitNullTime ¶
InitNullTime returns a NullTime with Time "date"
func (NullTime) MarshalJSON ¶
MarshalJSON marshals custom NullTime
func (*NullTime) UnmarshalJSON ¶
UnmarshalJSON unmarshals custom NullTime
type Option ¶
Option is query option
func (*Option) GetSort ¶
GetSort returns the sort object It controls if the sort key exists in the filters, for security reasons so that it only consider known fields
func (*Option) HasPopulate ¶
HasPopulate return true if it contains populate "key"
type Query ¶
type Query struct { Q string Opt *Option // Total of params contained in the query Values []interface{} }
Query are query options
func (*Query) AddValues ¶
func (q *Query) AddValues(values ...interface{})
AddValues add the values for the SQL query
func (*Query) SetBulkInsert ¶
SetBulkInsert adds bulk insert to the query baseValues are values that doesn't change or bulk inserting (can be empty) atrs are attributes of the values interface values are the dynamic values to bulk insert (attrs relates to this interfaces slice)
func (*Query) SetFilters ¶
SetFilters adds sql filters (LIKE) to the query isAnding tells the parser if it has to start whith a WHERE clause (false) or AND close (true) filters are the string values to filter with LIKE %filtre%
type SQLPatch ¶
SQLPatch is a struct for parsed resource to be patched
func SQLPatches ¶
func SQLPatches(resource interface{}) SQLPatch
SQLPatches parse the resource to be patched in the db (only update) source : https://play.golang.org/p/TdwAhb7pjT
func (*SQLPatch) GetUpdateQuery ¶
GetUpdateQuery build and return a db query string
type Storage ¶
type Storage struct { Session *session.Session Source string // contains filtered or unexported fields }
Storage is Wooble cloud storage interface
func (*Storage) BulkDeleteFiles ¶
func (s *Storage) BulkDeleteFiles()
BulkDeleteFiles delete pushed objects
func (*Storage) CopyAndStoreFile ¶
func (s *Storage) CopyAndStoreFile(userID string, objID string, prevVersion string, version string, filename string)
CopyAndStoreFile copy and store cloud object
func (*Storage) DeleteFile ¶
DeleteFile delete a file from the cloud
func (*Storage) GetFileContent ¶
func (s *Storage) GetFileContent(userID string, objID string, version string, filename string) string
GetFileContent returns requested file from the cloud
func (*Storage) GetPathFor ¶
GetPathFor returns object path
func (*Storage) PushBulkFile ¶
PushBulkFile prepares multiple files to be processed in the cloud
type StringSlice ¶
type StringSlice []string
StringSlice see https://gist.github.com/adharris/4163702
func (StringSlice) MarshalJSON ¶
func (s StringSlice) MarshalJSON() ([]byte, error)
MarshalJSON marshals custom ID
func (*StringSlice) String ¶
func (s *StringSlice) String() string