Documentation ¶
Index ¶
- func Hash(password string) ([]byte, error)
- func VerifyPassword(hashedPassword, password string) error
- type Event
- func (p *Event) DeleteAEvent(db *gorm.DB, eid uint64, uid uint32) (int64, error)
- func (p *Event) FindEventByID(db *gorm.DB, eid uint64) (*Event, error)
- func (p *Event) Prepare(Title, Content string, AuthorID int32)
- func (p *Event) SaveEvent(db *gorm.DB) (*Event, error)
- func (p *Event) UpdateAEvent(db *gorm.DB, eid uint64) (*Event, error)
- func (p *Event) Validate() error
- type User
- func (u *User) BeforeSave() error
- func (u *User) DeleteAUser(db *gorm.DB, uid uint32) (int64, error)
- func (u *User) FindAllEvents(db *gorm.DB, srv pbEvent.EventService_ListEventsServer) error
- func (u *User) FindAllUsers(db *gorm.DB, srv pbUser.UserService_ListUsersServer) error
- func (u *User) FindUserByID(db *gorm.DB, uid uint32) (*User, error)
- func (u *User) Prepare(Nickname, Email, Password string)
- func (u *User) SaveUser(db *gorm.DB) (*User, error)
- func (u *User) UpdateAUser(db *gorm.DB, uid uint32) (*User, error)
- func (u *User) Validate(action string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func VerifyPassword ¶
VerifyPassword : check password validity
Types ¶
type Event ¶
type Event struct { ID uint64 `gorm:"primary_key;auto_increment" json:"id"` Title string `gorm:"size:255;not null;unique" json:"title"` Content string `gorm:"size:255;not null;" json:"content"` Author User `json:"author"` AuthorID uint32 `gorm:"not null" json:"author_id"` CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"` UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"` }
Event : event entity
func (*Event) DeleteAEvent ¶
DeleteAEvent : delete one event
func (*Event) FindEventByID ¶
FindEventByID : find one event by id
func (*Event) UpdateAEvent ¶
UpdateAEvent : update one event
type User ¶
type User struct { ID uint32 `gorm:"primary_key;auto_increment" json:"id"` Nickname string `gorm:"size:255;not null;unique" json:"nickname"` Email string `gorm:"size:100;not null;unique" json:"email"` Password string `gorm:"size:100;not null;" json:"password"` CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"` UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"` }
User : user entity model database
func (*User) BeforeSave ¶
BeforeSave : hash password before saving
func (*User) DeleteAUser ¶
DeleteAUser : delete user
func (*User) FindAllEvents ¶
FindAllEvents : retrieve all events in database
func (*User) FindAllUsers ¶
FindAllUsers : retrieve all users in database
func (*User) FindUserByID ¶
FindUserByID : find one user by id
func (*User) UpdateAUser ¶
UpdateAUser : update one user fields
Click to show internal directories.
Click to hide internal directories.