36 lines
1.2 KiB
Go
36 lines
1.2 KiB
Go
package system
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
)
|
|
|
|
type MenuRepository interface {
|
|
Initialize(ctx context.Context) error
|
|
Create(ctx context.Context, obj *Menu) (*Menu, error)
|
|
Update(ctx context.Context, obj *Menu) error
|
|
Get(ctx context.Context, id int32) (*Menu, error)
|
|
GetByUrl(ctx context.Context, url string) (*Menu, error)
|
|
All(ctx context.Context) ([]*Menu, error)
|
|
Count(ctx context.Context) (int64, error)
|
|
RebuildParentPath(ctx context.Context) error
|
|
}
|
|
|
|
type Menu struct {
|
|
ID int32 `db:"id" json:"id"`
|
|
Name string `db:"name" json:"name"`
|
|
DisplayName string `db:"display_name" json:"display_name"`
|
|
Url string `db:"url" json:"url"`
|
|
Type string `db:"type" json:"type"`
|
|
ParentID int32 `db:"parent_id" json:"parent_id"`
|
|
ParentPath string `db:"parent_path" json:"parent_path"`
|
|
Avatar string `db:"avatar" json:"avatar"`
|
|
Style string `db:"style" json:"style"`
|
|
Visible bool `db:"visible" json:"visible"`
|
|
IsList bool `db:"is_list" json:"is_list"`
|
|
Status int32 `db:"status" json:"status"`
|
|
Sort int32 `db:"sort" json:"sort"`
|
|
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
|
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
|
|
}
|