user

package
v0.0.0-...-2ddb24b Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2025 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GenderMap = map[Gender]string{
		GenderMale:   "男性",
		GenderFemale: "女性",
		GenderOther:  "その他",
	}
)
View Source
var (
	OccupationMap = map[Occupation]string{
		OccupationFullTimeEmployee: "正社員",
		OccupationContractEmployee: "契約社員",
		OccupationPublicServant:    "公務員",
		OccupationSelfEmployed:     "自営業",
		OccupationExecutive:        "会社役員",
		OccupationPartTimeEmployee: "パート・アルバイト",
		OccupationHomemaker:        "家事従事者",
		OccupationStudent:          "学生",
		OccupationUnemployed:       "無職",
		OccupationOther:            "回答しない",
	}
)

Functions

This section is empty.

Types

type City

type City string

func NewCity

func NewCity(city *string) *City

func (City) String

func (m City) String() string

type Gender

type Gender int
const (
	GenderMale Gender = iota + 1
	GenderFemale
	GenderOther
)

func NewGender

func NewGender(s *string) *Gender

func (Gender) String

func (g Gender) String() string

type HouseholdSize

type HouseholdSize int

func NewHouseholdSize

func NewHouseholdSize(size *int) *HouseholdSize

type Occupation

type Occupation int
const (
	OccupationFullTimeEmployee Occupation = iota + 1 // 正社員
	OccupationContractEmployee                       // 契約社員
	OccupationPublicServant                          // 公務員
	OccupationSelfEmployed                           // 自営業
	OccupationExecutive                              // 会社役員
	OccupationPartTimeEmployee                       // パート・アルバイト
	OccupationHomemaker                              // 専業主婦
	OccupationStudent                                // 学生
	OccupationUnemployed                             // 無職
	OccupationOther                                  // 回答しない
)

func NewOccupation

func NewOccupation(occupation *string) *Occupation

func (Occupation) String

func (o Occupation) String() string

type ProfileIcon

type ProfileIcon struct {
	// contains filtered or unexported fields
}

func NewProfileIcon

func NewProfileIcon(
	url *string,
) *ProfileIcon

func (*ProfileIcon) ImageInfo

func (p *ProfileIcon) ImageInfo() *image.ImageInfo

func (*ProfileIcon) SetProfileIconImage

func (p *ProfileIcon) SetProfileIconImage(
	ctx context.Context,
	file *multipart.FileHeader,
	user User,
) error

func (*ProfileIcon) URL

func (p *ProfileIcon) URL() *string

type User

type User struct {
	// contains filtered or unexported fields
}

func NewUser

func NewUser(
	userID shared.UUID[User],
	displayID *string,
	displayName *string,
	subject string,
	provider auth.AuthProviderName,
	profileIcon *ProfileIcon,
) User

func (*User) ChangeName

func (u *User) ChangeName(ctx context.Context, name *string)

func (*User) DeleteIcon

func (u *User) DeleteIcon()

func (*User) Demographics

func (u *User) Demographics() *UserDemographic

func (*User) DisplayID

func (u *User) DisplayID() *string

func (*User) DisplayName

func (u *User) DisplayName() *string

func (*User) IsIconUpdateRequired

func (u *User) IsIconUpdateRequired() bool

func (*User) ProfileIcon

func (u *User) ProfileIcon() *ProfileIcon

func (*User) ProfileIconURL

func (u *User) ProfileIconURL() *string

func (*User) Provider

func (u *User) Provider() auth.AuthProviderName

func (*User) SetDemographics

func (u *User) SetDemographics(demographics UserDemographic)

func (*User) SetDisplayID

func (u *User) SetDisplayID(id string) error

func (*User) SetIconFile

func (u *User) SetIconFile(ctx context.Context, file *multipart.FileHeader) error

func (*User) Subject

func (u *User) Subject() string

func (*User) UserID

func (u *User) UserID() shared.UUID[User]

func (*User) Verify

func (u *User) Verify() bool

type UserDemographic

type UserDemographic struct {
	UserDemographicID shared.UUID[UserDemographic] // ユーザーのデモグラフィックスID
	// contains filtered or unexported fields
}

func NewUserDemographic

func NewUserDemographic(
	ctx context.Context,
	UserDemographicID shared.UUID[UserDemographic],
	yearOfBirth *int,
	occupation *string,
	gender *string,
	city *string,
	householdSize *int,
	prefecture *string,
) UserDemographic

func (*UserDemographic) Age

func (u *UserDemographic) Age(ctx context.Context) int

ユーザーの年齢を返す

func (*UserDemographic) ChangeYearOfBirth

func (u *UserDemographic) ChangeYearOfBirth(yearOfBirth *YearOfBirth)

func (*UserDemographic) City

func (u *UserDemographic) City() *City

func (*UserDemographic) Gender

func (u *UserDemographic) Gender() *Gender

func (*UserDemographic) HouseholdSize

func (u *UserDemographic) HouseholdSize() *HouseholdSize

func (*UserDemographic) ID

func (*UserDemographic) Occupation

func (u *UserDemographic) Occupation() *Occupation

func (*UserDemographic) Prefecture

func (u *UserDemographic) Prefecture() *string

func (*UserDemographic) YearOfBirth

func (u *UserDemographic) YearOfBirth() *YearOfBirth

type UserName

type UserName string

func (UserName) String

func (a UserName) String() string

type UserRepository

type UserRepository interface {
	Create(context.Context, User) error
	FindByID(context.Context, shared.UUID[User]) (*User, error)
	FindBySubject(context.Context, UserSubject) (*User, error)
	FindByDisplayID(context.Context, string) (*User, error)
	Update(context.Context, User) error
}

type UserService

type UserService interface {
	// DisplayIDCheckDuplicate ユーザーの表示用IDが重複していないかチェック
	DisplayIDCheckDuplicate(context.Context, string) (bool, error)
}

UserService ユーザードメインサービス

type UserSubject

type UserSubject string

func (UserSubject) String

func (a UserSubject) String() string

type YearOfBirth

type YearOfBirth int

func NewYearOfBirth

func NewYearOfBirth(year *int) *YearOfBirth

func (YearOfBirth) Age

func (y YearOfBirth) Age(ctx context.Context) int

Jump to

Keyboard shortcuts

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