Documentation
¶
Index ¶
- func AppInit(app *BaseApp)
- func BindNoteApi(app *BaseApp, rg *echo.Group)
- func BindUserApi(app *BaseApp, rg *echo.Group)
- func NewBaseApp() error
- type BaseApp
- type BaseModel
- type Note
- type NoteController
- func (ctrl *NoteController) DestroyNote(ctx echo.Context) error
- func (ctrl *NoteController) IndexNote(ctx echo.Context) error
- func (ctrl *NoteController) ShowNote(ctx echo.Context) error
- func (ctrl *NoteController) StoreNote(ctx echo.Context) error
- func (ctrl *NoteController) UpdateNote(ctx echo.Context) error
- type NoteSchema
- type User
- type UserController
- func (ctrl *UserController) DestroyUser(ctx echo.Context) error
- func (ctrl *UserController) IndexUser(ctx echo.Context) error
- func (ctrl *UserController) ShowUser(ctx echo.Context) error
- func (ctrl *UserController) StoreUser(ctx echo.Context) error
- func (ctrl *UserController) UpdateUser(ctx echo.Context) error
- type UserSchema
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BindNoteApi ¶
func BindUserApi ¶
func NewBaseApp ¶
func NewBaseApp() error
Types ¶
type BaseApp ¶
func (*BaseApp) AppCleanup ¶
type BaseModel ¶
type BaseModel struct {
ID string `gorm:"type:uuid;primaryKey;not null" json:"id,omitempty"`
CreatedAt time.Time `gorm:"not null;" json:"created_at,omitempty"`
UpdatedAt time.Time `gorm:"not null;" json:"updated_at,omitempty"`
DeletedAt *gorm.DeletedAt `gorm:"index" json:"deleted_at,omitempty"`
}
func (*BaseModel) GenerateId ¶
func (b *BaseModel) GenerateId()
type Note ¶
type Note struct {
BaseModel
NoteSchema
User *User `gorm:"foreignKey:UserId;references:ID" json:"user,omitempty"`
UserId string `gorm:"type:uuid;" json:"user_id,omitempty" form:"user_id"`
}
type NoteController ¶
type NoteController struct {
App *BaseApp
}
func (*NoteController) DestroyNote ¶
func (ctrl *NoteController) DestroyNote(ctx echo.Context) error
func (*NoteController) UpdateNote ¶
func (ctrl *NoteController) UpdateNote(ctx echo.Context) error
type NoteSchema ¶
type NoteSchema struct {
Title string `gorm:"not null;" json:"title,omitempty" form:"title"`
Body string `gorm:"not null;" json:"body,omitempty" form:"body"`
Private bool `gorm:"default:false;" json:"private,omitempty" form:"private"`
}
--------------- Note Model ---------------
type User ¶
type User struct {
BaseModel
UserSchema
Notes []Note `gorm:"foreignKey:UserId;references:ID;Constraints:onDelete:Cascade;" json:"notes"`
}
type UserController ¶
type UserController struct {
App *BaseApp
}
func (*UserController) DestroyUser ¶
func (ctrl *UserController) DestroyUser(ctx echo.Context) error
func (*UserController) UpdateUser ¶
func (ctrl *UserController) UpdateUser(ctx echo.Context) error
type UserSchema ¶
type UserSchema struct {
Username string `gorm:"unique;not null;" json:"username,omitempty" form:"username"`
Email string `gorm:"unique;not null;" json:"email,omitempty" form:"email"`
Password string `gorm:"not null;" json:"password,omitempty" form:"password"`
}
--------------- User Model ---------------
Click to show internal directories.
Click to hide internal directories.