profile

package
v2.1.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFoundTranslate = translator.Translate{translator.RU: "Профиль не найден", translator.EN: "Profile not found"}
	ErrExistsTranslate   = translator.Translate{translator.RU: "Профиль уже зарегистрирован", translator.EN: "A profile is already registered"}
)
View Source
var OrderBy = clause.FieldOrderBy{}
View Source
var Searchable = clause.FieldSearchable{}

Functions

This section is empty.

Types

type IRepository

type IRepository interface {
	repository.Repository[IRepository, Profile]
}

type Profile

type Profile struct {
	ID      int    `json:"id"`
	Age     *int   `json:"age"`
	Height  *int   `json:"height"`
	Address string `json:"address"`

	UserID int `json:"user_id"`
}

func (Profile) TableName

func (m Profile) TableName() string

type ProfileCreateInput

type ProfileCreateInput struct {
	Age     *int
	Height  *int
	Address string
}

type ProfileCreateRequest

type ProfileCreateRequest struct {
	Age     *int   `json:"age" binding:"omitempty,gte=0"`
	Height  *int   `json:"height" binding:"omitempty,gte=0"`
	Address string `json:"address" binding:"required,min=1,max=255"`
}

type ProfileUpdateInput

type ProfileUpdateInput struct {
	Age     *int
	Height  *int
	Address *string
}

type ProfileUpdateProfileInput

type ProfileUpdateProfileInput struct {
	Age     *int
	Height  *int
	Address *string
}

type ProfileUpdateRequest

type ProfileUpdateRequest struct {
	Age     *int    `json:"age" binding:"omitempty,gte=0"`
	Height  *int    `json:"height" binding:"omitempty,gte=0"`
	Address *string `json:"address" binding:"omitempty,min=1,max=255"`
}

type Repository

type Repository struct {
	repository.Repo[Profile]
}

func NewProfileRepository

func NewProfileRepository(db *gorm.DB) Repository

func (Repository) Joins

func (r Repository) Joins(models ...string) IRepository

func (Repository) Omit

func (r Repository) Omit(columns ...string) IRepository

func (Repository) Trx

func (r Repository) Trx(db *gorm.DB) IRepository

func (Repository) With

func (r Repository) With(models ...string) IRepository

type Request

type Request[CreateInput ProfileCreateInput, UpdateInput ProfileUpdateInput, UpdateProfileInput ProfileUpdateProfileInput] struct {
}

func NewRequest

func NewRequest[CreateInput ProfileCreateInput, UpdateInput ProfileUpdateInput, UpdateProfileInput ProfileUpdateProfileInput]() *Request[CreateInput, UpdateInput, UpdateProfileInput]

func (Request[CreateInput, UpdateInput, UpdateProfileInput]) CreateRequest

func (r Request[CreateInput, UpdateInput, UpdateProfileInput]) CreateRequest(c *gin.Context) (*CreateInput, error)

func (Request[CreateInput, UpdateInput, UpdateProfileInput]) UpdateProfileRequest

func (r Request[CreateInput, UpdateInput, UpdateProfileInput]) UpdateProfileRequest(c *gin.Context) (*UpdateProfileInput, error)

func (Request[CreateInput, UpdateInput, UpdateProfileInput]) UpdateRequest

func (r Request[CreateInput, UpdateInput, UpdateProfileInput]) UpdateRequest(c *gin.Context) (*UpdateInput, error)

type Service

type Service[Model Profile, CreateInput ProfileCreateInput, UpdateInput ProfileUpdateInput, UpdateProfileInput ProfileUpdateProfileInput] struct {
	// contains filtered or unexported fields
}

func NewService

func NewService[Model Profile, CreateInput ProfileCreateInput, UpdateInput ProfileUpdateInput, UpdateProfileInput ProfileUpdateProfileInput](
	profileRepository IRepository,
) Service[Model, CreateInput, UpdateInput, UpdateProfileInput]

func (Service[Model, CreateInput, UpdateInput, UpdateProfileInput]) Create

func (s Service[Model, CreateInput, UpdateInput, UpdateProfileInput]) Create(ctx context.Context, userID int, input CreateInput) (*Model, error)

func (Service[Model, CreateInput, UpdateInput, UpdateProfileInput]) Delete

func (s Service[Model, CreateInput, UpdateInput, UpdateProfileInput]) Delete(ctx context.Context, userID int) error

func (Service[Model, CreateInput, UpdateInput, UpdateProfileInput]) GetById

func (s Service[Model, CreateInput, UpdateInput, UpdateProfileInput]) GetById(ctx context.Context, userID int) (*Model, error)

func (Service[Model, CreateInput, UpdateInput, UpdateProfileInput]) GetByIds

func (s Service[Model, CreateInput, UpdateInput, UpdateProfileInput]) GetByIds(ctx context.Context, userID ...int) ([]Model, error)

func (Service[Model, CreateInput, UpdateInput, UpdateProfileInput]) Trx

func (s Service[Model, CreateInput, UpdateInput, UpdateProfileInput]) Trx(db *gorm.DB) profile.IProfileService[Model, CreateInput, UpdateInput, UpdateProfileInput]

func (Service[Model, CreateInput, UpdateInput, UpdateProfileInput]) Update

func (s Service[Model, CreateInput, UpdateInput, UpdateProfileInput]) Update(ctx context.Context, userID int, input UpdateInput) error

func (Service[Model, CreateInput, UpdateInput, UpdateProfileInput]) UpdateProfile

func (s Service[Model, CreateInput, UpdateInput, UpdateProfileInput]) UpdateProfile(ctx context.Context, userID int, input UpdateProfileInput) error

type Transform

type Transform struct {
	Age     *int   `json:"age"`
	Height  *int   `json:"height"`
	Address string `json:"address"`
}

type Transformer

type Transformer[Model Profile] struct {
}

func NewTransformer

func NewTransformer[Model Profile]() *Transformer[Model]

func (Transformer[Model]) Transform

func (r Transformer[Model]) Transform(m *Model) interface{}

func (Transformer[Model]) TransformList

func (r Transformer[Model]) TransformList(m *Model) interface{}

func (Transformer[Model]) TransformProfile

func (r Transformer[Model]) TransformProfile(m *Model) interface{}

type UpdateProfileRequest

type UpdateProfileRequest struct {
	Age     *int    `json:"age" binding:"omitempty,gte=0"`
	Height  *int    `json:"height" binding:"omitempty,gte=0"`
	Address *string `json:"address" binding:"omitempty,min=1,max=255"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL