Documentation ¶
Index ¶
- func CreateUserToken(app *bunapp.App, userID uint64, ttl time.Duration) (string, error)
- func HealthCheckHandler(w http.ResponseWriter, req bunrouter.Request) error
- type FollowUser
- type HealthCheckResponse
- type Middleware
- type Profile
- type Session
- type SessionHandler
- type User
- type UserHandler
- func (h UserHandler) Create(w http.ResponseWriter, req bunrouter.Request) error
- func (*UserHandler) Current(w http.ResponseWriter, req bunrouter.Request) error
- func (h UserHandler) Follow(w http.ResponseWriter, req bunrouter.Request) error
- func (h UserHandler) Profile(w http.ResponseWriter, req bunrouter.Request) error
- func (h UserHandler) Unfollow(w http.ResponseWriter, req bunrouter.Request) error
- func (h UserHandler) Update(w http.ResponseWriter, req bunrouter.Request) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateUserToken ¶
func HealthCheckHandler ¶
func HealthCheckHandler(w http.ResponseWriter, req bunrouter.Request) error
Types ¶
type FollowUser ¶
type HealthCheckResponse ¶
type Middleware ¶
type Middleware struct {
// contains filtered or unexported fields
}
func NewMiddleware ¶
func NewMiddleware(app *bunapp.App) Middleware
func (Middleware) MustUser ¶
func (m Middleware) MustUser(next bunrouter.HandlerFunc) bunrouter.HandlerFunc
func (Middleware) User ¶
func (m Middleware) User(next bunrouter.HandlerFunc) bunrouter.HandlerFunc
type Profile ¶
type Profile struct { bun.BaseModel `bun:"users,alias:u"` ID uint64 `json:"-"` Username string `json:"username"` Bio string `json:"bio"` Image string `json:"image"` Following bool `bun:",scanonly" json:"following"` }
func NewProfile ¶
type Session ¶
type Session struct { bun.BaseModel `bun:",alias:s"` ID uint64 `json:"-" bun:",pk,autoincrement"` UserId uint64 `json:"userId"` User User `json:"user" bun:"rel:belongs-to"` Token string `bun:",notnull,unique" json:"token,omitempty"` Provider string `json:"provider" bun:"default:'LOCAL'"` LastTimeActive time.Time `json:"lastTimeActive" bun:"default:current_timestamp"` ExpiresAt time.Time `json:"expiresAt"` DeviceInfo map[string]interface{} `json:"deviceInfo" bun:"type:jsonb,default:'{}'"` }
func SelectSessionByToken ¶
func SessionFromContext ¶
type SessionHandler ¶
type SessionHandler struct {
// contains filtered or unexported fields
}
func NewSessionHandler ¶
func NewSessionHandler(app *bunapp.App) SessionHandler
func (SessionHandler) Login ¶
func (h SessionHandler) Login(w http.ResponseWriter, req bunrouter.Request) error
func (SessionHandler) Logout ¶
func (h SessionHandler) Logout(w http.ResponseWriter, req bunrouter.Request) error
type User ¶
type User struct { bun.BaseModel `bun:",alias:u"` ID uint64 `json:"-" bun:",pk,autoincrement"` Name string `json:"name"` LastName string `json:"lastName"` Username string `json:"username" bun:",unique"` Email string `json:"email"` Image string `json:"image"` Password string `bun:",notnull" json:"password,omitempty"` }
func SelectUserByUsername ¶
func UserFromContext ¶
func (*User) ComparePassword ¶
type UserHandler ¶
type UserHandler struct {
// contains filtered or unexported fields
}
func NewUserHandler ¶
func NewUserHandler(app *bunapp.App) UserHandler
func (UserHandler) Create ¶
func (h UserHandler) Create(w http.ResponseWriter, req bunrouter.Request) error
func (*UserHandler) Current ¶
func (*UserHandler) Current(w http.ResponseWriter, req bunrouter.Request) error
func (UserHandler) Follow ¶
func (h UserHandler) Follow(w http.ResponseWriter, req bunrouter.Request) error
func (UserHandler) Profile ¶
func (h UserHandler) Profile(w http.ResponseWriter, req bunrouter.Request) error
func (UserHandler) Unfollow ¶
func (h UserHandler) Unfollow(w http.ResponseWriter, req bunrouter.Request) error
func (UserHandler) Update ¶
func (h UserHandler) Update(w http.ResponseWriter, req bunrouter.Request) error
Click to show internal directories.
Click to hide internal directories.