Documentation ¶
Overview ¶
@alchemy replace package dao
@alchemy replace package dao
Index ¶
- func SetIfPresent(target interface{}, fieldName string, value interface{}) error
- type IUserDao
- type User
- type UserCreatePayload
- type UserDao
- func (u *UserDao) Create(payload UserCreatePayload) (*User, error)
- func (u *UserDao) Delete(id string) error
- func (u *UserDao) Get(id string) (user *User, err error)
- func (u *UserDao) GetByEmail(email string) (user *User, err error)
- func (u *UserDao) List() (users []User, err error)
- func (u *UserDao) Update(id string, payload UserUpdatePayload) (*User, error)
- type UserUpdatePayload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetIfPresent ¶
SetIfPresent sets a field of a struct if the provided value is not nil.
Types ¶
type IUserDao ¶
type IUserDao interface { List() ([]User, error) // @alchemy block {{- if .Login }} Get(string) (*User, error) GetByEmail(string) (*User, error) // @alchemy block {{- end }} // @alchemy block {{- if .Register }} Create(UserCreatePayload) (*User, error) // @alchemy block {{- end }} Update(string, UserUpdatePayload) (*User, error) Delete(string) error }
func NewUserDao ¶
type User ¶
type User struct { Id string `json:"id" gorm:"column:id;primaryKey;type:uuid;default:gen_random_uuid()"` FirstName *string `json:"firstName" gorm:"column:first_name"` LastName *string `json:"lastName" gorm:"column:last_name"` Email string `json:"email" gorm:"email;unique"` Password string `json:"-" gorm:"password"` }
type UserCreatePayload ¶
type UserDao ¶
type UserDao struct {
// contains filtered or unexported fields
}
func (*UserDao) GetByEmail ¶
@alchemy block {{- if .Login }}
Click to show internal directories.
Click to hide internal directories.