Documentation ¶
Index ¶
- Constants
- type Area
- type AreaRepo
- type AreaUsecase
- func (m *AreaUsecase) Create(ctx context.Context, data CreateParam) (*Area, error)
- func (m *AreaUsecase) Delete(ctx context.Context, ids ...int) error
- func (m *AreaUsecase) FindByRegionID(ctx context.Context, regionID string, level int) (*Area, error)
- func (m *AreaUsecase) FindOne(ctx context.Context, id int) (*Area, error)
- func (m *AreaUsecase) List(ctx context.Context, params FindListParam) ([]*Area, error)
- func (m *AreaUsecase) Update(ctx context.Context, data UpdateParam) (*Area, error)
- type CascadeArea
- type CreateParam
- type FindListParam
- type Inquirer
- type Query
- func Cache(ttl int) Query
- func IDEQ(id int) Query
- func IDIn(ids ...int) Query
- func LevelEQ(level int) Query
- func Limit(limit int) Query
- func Offset(offset int) Query
- func Order(orders ...string) Query
- func ParentIDEQ(parentID int) Query
- func RegionIDEQ(regionID string) Query
- func TitleContains(keyword string) Query
- type UpdateParam
Constants ¶
View Source
const ( // 区域地址长度为10 AREA_REGIONID_LENGTH int = 10 // 区域最小等级 AREA_MIN_LEVEL int = 1 // 区域最大等级 AREA_MAX_LEVEL int = 4 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Area ¶
type Area struct { ID int ParentID int RegionID string ParentList string Title string Pinyin string Ucfirst string Lng float64 Lat float64 Geohash string GeoGs2 string GeoGs2ID uint64 GeoGs2Level uint32 GeoGs2Face uint32 CityCode string ZipCode string Level int ChildrenNumber int DeletedAt time.Time CreateAt time.Time UpddateAt time.Time }
区域数据实体
type AreaRepo ¶
type AreaRepo interface { Count(ctx context.Context, options ...Query) int // FindList 查找数据列表 FindList(ctx context.Context, options ...Query) ([]*Area, error) // FindOne 查找数据 FindOne(ctx context.Context, options ...Query) (*Area, error) // Save 新增或保存数据 Save(ctx context.Context, data *Area) (*Area, error) // Remove 移除数据 Remove(ctx context.Context, options ...Query) error // ReplaceParentListPrefix 替换父级列表前缀 ReplaceParentListPrefix(ctx context.Context, oldPrefix, newPrefix string) (int, error) }
type AreaUsecase ¶
type AreaUsecase struct {
// contains filtered or unexported fields
}
func NewAreaUsecase ¶
func NewAreaUsecase(repo AreaRepo) *AreaUsecase
func (*AreaUsecase) Create ¶
func (m *AreaUsecase) Create(ctx context.Context, data CreateParam) (*Area, error)
func (*AreaUsecase) Delete ¶
func (m *AreaUsecase) Delete(ctx context.Context, ids ...int) error
Delete 删除值
func (*AreaUsecase) FindByRegionID ¶
func (*AreaUsecase) List ¶
func (m *AreaUsecase) List(ctx context.Context, params FindListParam) ([]*Area, error)
List 列表更新
func (*AreaUsecase) Update ¶
func (m *AreaUsecase) Update(ctx context.Context, data UpdateParam) (*Area, error)
type CascadeArea ¶
type CascadeArea struct { ID uint64 RegionID string Title string Pinyin string Ucfirst string Level int ChildrenNumber int Items []*CascadeArea }
级联区域实体
type CreateParam ¶
type FindListParam ¶
type FindListParam struct { // ParentID 父级ID ParentID int // RegionID 父级区域ID RegionID string // Level 区域级别 Level int // Keyword 搜索关键字 Keyword string // Order 排序 Order string }
查找参数
type UpdateParam ¶
type UpdateParam struct { ID int CreateParam }
Click to show internal directories.
Click to hide internal directories.