Documentation ¶
Index ¶
- func IsUUID(id string) bool
- func NewUUID() string
- type AdminDetailDto
- type AdminListDto
- type Alert
- type AlertDto
- type BaseTranslation
- type CreatedEvent
- type DeletedEvent
- type DetailDto
- type DisabledEvent
- type EnabledEvent
- type Entity
- func (e *Entity) BeforeCreate()
- func (e *Entity) BeforeUpdate()
- func (e Entity) GetInput(uuid string) (Input, bool)
- func (e *Entity) HasValidator(name string) bool
- func (e *Entity) IsMain() bool
- func (e *Entity) ToAdminDetail() *AdminDetailDto
- func (e *Entity) ToAdminList() *AdminListDto
- func (e *Entity) ToAlert() []*AlertDto
- func (e *Entity) ToDetail() *DetailDto
- func (e *Entity) ToInputGroup() []*InputGroupDto
- func (e *Entity) ToList() *ListDto
- func (m *Entity) ToMetaList() map[Locale]*MetaListDto
- func (m *Entity) ToMetaMini() map[Locale]*MetaMiniDto
- func (e *Entity) ToRule() []*RuleDto
- type Errors
- type EventConfig
- type Events
- type Factory
- type I18nDetail
- type Image
- type Input
- type InputExtra
- type InputGroup
- type InputGroupDto
- type InputTranslation
- type InputType
- type ListDto
- type ListingValidationFailedEvent
- type ListingValidationSuccessEvent
- type Locale
- type Meta
- type MetaListDto
- type MetaMiniDto
- type NewConfig
- type OrderUpdatedEvent
- type Repository
- type Rule
- type RuleDto
- type Seo
- type SeoAttribute
- type SeoExtra
- type UpdatedEvent
- type UserDetailEvent
- type Validator
- type ValidatorFunc
- type Validators
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AdminDetailDto ¶
type AdminDetailDto struct {
*Entity
}
type AdminListDto ¶
type AdminListDto struct { UUID string `json:"uuid" bson:"_id,omitempty"` MainUUIDs []string `json:"mainUUIDs" bson:"main_uuids"` Images []Image `json:"images" bson:"images"` Meta map[Locale]*MetaListDto `json:"meta" bson:"meta"` IsActive bool `json:"isActive" bson:"is_active"` IsDeleted bool `json:"isDeleted" bson:"is_deleted"` UpdatedAt time.Time `json:"updatedAt" bson:"updated_at"` }
type Alert ¶
type Alert struct { UUID string `json:"uuid" bson:"uuid" validate:"required,uuid4"` Translations map[Locale]BaseTranslation `json:"translations" bson:"translations"` Type string `json:"type" bson:"type"` // info, warning, error }
type AlertDto ¶
type AlertDto struct { UUID string `json:"uuid"` CategoryMeta map[Locale]*MetaMiniDto `json:"categoryMeta"` Translations map[Locale]BaseTranslation `json:"translations"` Type string `json:"type"` }
type BaseTranslation ¶
type CreatedEvent ¶
type DeletedEvent ¶
type DisabledEvent ¶
type EnabledEvent ¶
type Entity ¶
type Entity struct { UUID string `json:"uuid" bson:"_id,omitempty"` MainUUID string `json:"mainUUID" bson:"main_uuid,omitempty" validate:"omitempty,object_id"` MainUUIDs []string `json:"mainUUIDs" bson:"main_uuids" validate:"omitempty,dive,object_id"` Images []Image `json:"images" bson:"images" validate:"min=1,max=30,dive,required"` Meta map[Locale]*Meta `json:"meta" bson:"meta" validate:"required,dive"` InputGroups []InputGroup `json:"inputGroups" bson:"input_groups" validate:"required,dive"` Inputs []Input `json:"inputs" bson:"inputs" validate:"required,dive"` Rules []Rule `json:"rules" bson:"rules" validate:"required,dive"` Alerts []Alert `json:"alerts" bson:"alerts" validate:"required,dive"` Validators []string `json:"validators" bson:"validators" validate:"required,min=1"` Order int `json:"order" bson:"order" validate:"required,min=0,max=100"` IsActive bool `json:"isActive" bson:"is_active" validate:"required,boolean"` IsDeleted bool `json:"isDeleted" bson:"is_deleted" validate:"required,boolean"` CreatedAt time.Time `json:"createdAt" bson:"created_at" validate:"required"` UpdatedAt time.Time `json:"updatedAt" bson:"updated_at" validate:"required"` }
func (*Entity) BeforeCreate ¶
func (e *Entity) BeforeCreate()
func (*Entity) BeforeUpdate ¶
func (e *Entity) BeforeUpdate()
func (*Entity) HasValidator ¶
func (*Entity) ToAdminDetail ¶
func (e *Entity) ToAdminDetail() *AdminDetailDto
func (*Entity) ToAdminList ¶
func (e *Entity) ToAdminList() *AdminListDto
func (*Entity) ToInputGroup ¶
func (e *Entity) ToInputGroup() []*InputGroupDto
func (*Entity) ToMetaList ¶
func (m *Entity) ToMetaList() map[Locale]*MetaListDto
func (*Entity) ToMetaMini ¶
func (m *Entity) ToMetaMini() map[Locale]*MetaMiniDto
type Errors ¶
type Errors interface { InvalidInputType(t string) *i18np.Error InvalidInputUUID(uuid string) *i18np.Error InvalidInputGroupUUID(uuid string) *i18np.Error Failed(action string) *i18np.Error NotFound() *i18np.Error MinOneTranslationRequired(field string) *i18np.Error InvalidMetaLength(len int) *i18np.Error InvalidImagesLength(len int) *i18np.Error InvalidUUID(uuid string) *i18np.Error InvalidCategoryInputType(t string, value interface{}) *i18np.Error ParentUUIDIsNotEmpty() *i18np.Error ParentUUIDIsNotCorrect() *i18np.Error CategoryUUIDsIsNotCorrect() *i18np.Error FeatureIsNotCorrect() *i18np.Error }
type Events ¶
type Events interface { Created(event CreatedEvent) Updated(event UpdatedEvent) Enabled(event EnabledEvent) Disabled(event DisabledEvent) Deleted(event DeletedEvent) UpdateOrder(event OrderUpdatedEvent) ListingValidationSuccess(event ListingValidationSuccessEvent) ListingValidationFailed(event ListingValidationFailedEvent) }
func NewEvents ¶
func NewEvents(cnf EventConfig) Events
type I18nDetail ¶
type Input ¶
type Input struct { UUID string `json:"uuid" bson:"uuid" validate:"required,uuid4"` GroupUUID string `json:"groupUUID" bson:"group_uuid"` Type InputType `json:"type" bson:"type" validate:"required"` Translations map[Locale]*InputTranslation `json:"translations" bson:"translations" validate:"required,dive"` IsRequired *bool `json:"isRequired" bson:"is_required" validate:"required,boolean"` IsMultiple *bool `json:"isMultiple" bson:"is_multiple" validate:"required,boolean"` IsUnique *bool `json:"isUnique" bson:"is_unique" validate:"required,boolean"` IsPayed *bool `json:"isPayed" bson:"is_payed" validate:"required,boolean"` Extra []InputExtra `json:"extra" bson:"extra" validate:"required,dive"` Options []string `json:"options" bson:"options" validate:"required,min=0"` }
type InputExtra ¶
type InputGroup ¶
type InputGroup struct { UUID string `json:"uuid" bson:"uuid" validate:"required,uuid4"` Icon string `json:"icon" bson:"icon" validate:"required,max=255,min=3"` Translations map[Locale]BaseTranslation `json:"translations" bson:"translations" validate:"required,dive"` }
type InputGroupDto ¶
type InputGroupDto struct { UUID string `json:"uuid" bson:"uuid" validate:"required,uuid4"` Icon string `json:"icon" bson:"icon" validate:"required,max=255,min=3"` Translations map[Locale]BaseTranslation `json:"translations" bson:"translations" validate:"required,dive"` Inputs []Input `json:"inputs" bson:"inputs" validate:"required,dive"` }
type InputTranslation ¶
type InputType ¶
type InputType string
const ( InputTypeText InputType = "text" InputTypeTextarea InputType = "textarea" InputTypeNumber InputType = "number" InputTypeSelect InputType = "select" InputTypeRadio InputType = "radio" InputTypeCheckbox InputType = "checkbox" InputTypeDate InputType = "date" InputTypeTime InputType = "time" InputTypeDatetime InputType = "datetime" InputTypeFile InputType = "file" InputTypeImage InputType = "image" InputTypePDF InputType = "pdf" InputTypeRange InputType = "range" InputTypeColor InputType = "color" InputTypeURL InputType = "url" InputTypeEmail InputType = "email" InputTypeTel InputType = "tel" InputTypeLocation InputType = "location" InputTypePrice InputType = "price" InputTypeRating InputType = "rating" )
type ListDto ¶
type ListDto struct { UUID string `json:"uuid" bson:"_id,omitempty"` MainUUIDs []string `json:"mainUUIDs" bson:"main_uuids"` Images []Image `json:"images" bson:"images"` Meta map[Locale]*MetaListDto `json:"meta" bson:"meta"` }
type ListingValidationFailedEvent ¶
type ListingValidationFailedEvent struct { ListingUUID string `json:"listingUUID"` BusinessUUID string `json:"business_uuid"` BusinessName string `json:"business_name"` Listing *listing.Entity `json:"entity"` Errors []*listing.ValidationError `json:"errors"` User UserDetailEvent `json:"user"` }
type Meta ¶
type Meta struct { Name string `json:"name" bson:"name" validate:"required,max=255,min=3"` Description string `json:"description" bson:"description" validate:"required,max=255,min=5"` Title string `json:"title" bson:"title" validate:"required,max=100,min=5"` Slug string `json:"slug" bson:"slug"` Seo Seo `json:"seo" bson:"seo" validate:"required"` }
func (*Meta) ToList ¶
func (m *Meta) ToList() *MetaListDto
func (*Meta) ToMini ¶
func (m *Meta) ToMini() *MetaMiniDto
type MetaListDto ¶
type MetaMiniDto ¶
type OrderUpdatedEvent ¶
type Repository ¶
type Repository interface { Create(ctx context.Context, entity *Entity) (*Entity, *i18np.Error) Update(ctx context.Context, entity *Entity) *i18np.Error Delete(ctx context.Context, categoryUUID string) *i18np.Error Disable(ctx context.Context, categoryUUID string) *i18np.Error Enable(ctx context.Context, categoryUUID string) *i18np.Error FindChild(ctx context.Context, categoryUUID string) ([]*Entity, *i18np.Error) Find(ctx context.Context, categoryUUID string) (*Entity, *i18np.Error) FindAll(ctx context.Context, categoryUUIDs []string) ([]*Entity, *i18np.Error) AdminFindAll(ctx context.Context, onlyMains bool) ([]*Entity, *i18np.Error) AdminFindChild(ctx context.Context, categoryUUID string) ([]*Entity, *i18np.Error) UpdateOrder(ctx context.Context, categoryUUID string, order int16) *i18np.Error FindBySlug(ctx context.Context, i18n I18nDetail) (*Entity, *i18np.Error) FindFieldsByUUIDs(ctx context.Context, categoryUUIDs []string) ([]*Entity, *i18np.Error) FindByUUIDs(ctx context.Context, categoryUUIDs []string) ([]*Entity, *i18np.Error) }
func NewRepo ¶
func NewRepo(collection *mongo.Collection, factory Factory) Repository
type Rule ¶
type Rule struct { UUID string `json:"uuid" bson:"uuid" validate:"required,uuid4"` Translations map[Locale]BaseTranslation `json:"translations" bson:"translations" validate:"required,dive"` }
type RuleDto ¶
type RuleDto struct { UUID string `json:"uuid"` CategoryMeta map[Locale]*MetaMiniDto `json:"categoryMeta"` Translations map[Locale]BaseTranslation `json:"translations"` }
type Seo ¶
type Seo struct { Title string `json:"title" bson:"title" validate:"required,max=100,min=5"` Description string `json:"description" bson:"description" validate:"required,max=255,min=5"` Keywords string `json:"keywords" bson:"keywords" validate:"required,max=255,min=5"` Canonical string `json:"canonical" bson:"canonical" validate:"omitempty,url"` Extra []SeoExtra `json:"extra" bson:"extra" validate:"required"` }
type SeoAttribute ¶
type SeoExtra ¶
type SeoExtra struct { Name string `json:"name" bson:"name" validate:"required,max=255,min=3"` Content string `json:"content" bson:"content" validate:"required,max=255,min=3"` Attributes []SeoAttribute `json:"attributes" bson:"attributes" validate:"required"` }
type UpdatedEvent ¶
type UserDetailEvent ¶
type ValidatorFunc ¶
type Validators ¶
func NewValidators ¶
func NewValidators(errors Errors, config config.App) Validators
func (Validators) GetValidator ¶
func (v Validators) GetValidator(t InputType) (Validator, bool)
Click to show internal directories.
Click to hide internal directories.