Skip to content

Commit

Permalink
add comment (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
dchaofei authored Dec 15, 2022
1 parent aee6be9 commit e89a631
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 12 deletions.
15 changes: 10 additions & 5 deletions wechaty-puppet/schemas/contact.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,17 @@ const (

// ContactQueryFilter use the first non-empty parameter of all parameters to search
type ContactQueryFilter struct {
Alias string
// 别名过滤
Alias string
// 别名正则表达式过滤
AliasRegexp *regexp.Regexp
Id string
Name string
NameRegexp *regexp.Regexp
WeiXin string
// id 过滤
Id string
// 昵称过滤
Name string
// 昵称正则表达式过滤
NameRegexp *regexp.Regexp
WeiXin string
}

type ContactPayload struct {
Expand Down
7 changes: 5 additions & 2 deletions wechaty-puppet/schemas/room.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ type RoomMemberQueryFilter struct {
}

type RoomQueryFilter struct {
Id string
Topic string
// 使用 room id 过滤
Id string
// 使用群名称过滤
Topic string
// 群名称正则过滤
TopicRegexp *regexp.Regexp
}

Expand Down
2 changes: 2 additions & 0 deletions wechaty/interface/contact.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ type IContactFactory interface {
Load(id string) IContact
LoadSelf(id string) IContactSelf
// Find query params is string or *schemas.ContactQueryFilter
// when the parameter is a string type, the name search is used by default
Find(query interface{}) IContact
// FindAll query params is string or *schemas.ContactQueryFilter
// when the parameter is a string type, the name search is used by default
FindAll(query interface{}) []IContact
// Tags get tags for all contact
Tags() []ITag
Expand Down
7 changes: 4 additions & 3 deletions wechaty/interface/room.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type IRoomFactory interface {
Create(contactList []IContact, topic string) (IRoom, error)
FindAll(query *schemas.RoomQueryFilter) []IRoom
// Find query params is string or *schemas.RoomQueryFilter
// when the parameter is a string type, the room name search is used by default
Find(query interface{}) IRoom
Load(id string) IRoom
}
Expand All @@ -20,11 +21,11 @@ type IRoom interface {
IsReady() bool
String() string
ID() string
// Find all contacts in a room
// params nil or string or RoomMemberQueryFilter
// MemberAll all contacts in a room
// params nil or string or *schemas.RoomMemberQueryFilter
MemberAll(query interface{}) ([]IContact, error)
// Member Find all contacts in a room, if get many, return the first one.
// query params string or RoomMemberQueryFilter
// query params string or *schemas.RoomMemberQueryFilter
Member(query interface{}) (IContact, error)
// Alias return contact's roomAlias in the room
Alias(contact IContact) (string, error)
Expand Down
4 changes: 2 additions & 2 deletions wechaty/user/room.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ func (r *Room) ID() string {
return r.id
}

// Find all contacts in a room
// params nil or string or RoomMemberQueryFilter
// MemberAll all contacts in a room
// params nil or string or *schemas.RoomMemberQueryFilter
func (r *Room) MemberAll(query interface{}) ([]_interface.IContact, error) {
if query == nil {
return r.memberList()
Expand Down

0 comments on commit e89a631

Please sign in to comment.