Merge remote-tracking branch 'upstream/main'

# Conflicts:
#	pkg/proto/wrapperspb/wrapperspb.go
pull/636/head
BanTanger 2 years ago
commit 411c5aff95

16
.github/sync.yml vendored

@ -67,6 +67,10 @@ group:
- repos: | - repos: |
OpenIMSDK/OpenKF@main OpenIMSDK/OpenKF@main
OpenIMSDK/openim-miniprogram-demo@main OpenIMSDK/openim-miniprogram-demo@main
OpenIMSDK/docs
OpenIMSDK/chat
OpenIMSDK/community
OpenIMSDK/openim-charts
OpenIMSDK/openim-sdk-cpp@main OpenIMSDK/openim-sdk-cpp@main
files: files:
- source: LICENSE - source: LICENSE
@ -87,6 +91,18 @@ group:
- source: .github/.codecov.yml - source: .github/.codecov.yml
dest: .github/.codecov.yml dest: .github/.codecov.yml
replace: false replace: false
- source: .github/workflows/cla.yml
dest: .github/workflows/cla.yml
replace: false
- source: .github/workflows/
dest: .github/workflows/
replace: false
- source: .github/workflows/auto-assign-issue.yml
dest: .github/workflows/auto-assign-issue.yml
replace: false
- source: .github/workflows/release.yml
dest: .github/workflows/release.yml
replace: false
- source: ./scripts/githooks/ - source: ./scripts/githooks/
dest: ./scripts/githooks/ dest: ./scripts/githooks/
replace: true replace: true

@ -2,7 +2,6 @@ name: Assign issue to comment author
on: on:
issue_comment: issue_comment:
types: [created] types: [created]
jobs: jobs:
assign-issue: assign-issue:
if: contains(github.event.comment.body, '/assign') || contains(github.event.comment.body, '/accept') if: contains(github.event.comment.body, '/assign') || contains(github.event.comment.body, '/accept')
@ -11,15 +10,17 @@ jobs:
issues: write issues: write
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Assign the issue - name: Assign the issue
run: | run: |
export LETASE_MILESTONES=$(curl "https://api.github.com/repos/$OWNER/$REPO/milestones" | jq -r 'last(.[]).title')
gh issue edit ${{ github.event.issue.number }} --add-assignee "${{ github.event.comment.user.login }}" gh issue edit ${{ github.event.issue.number }} --add-assignee "${{ github.event.comment.user.login }}"
gh issue edit ${{ github.event.issue.number }} --add-label "triage/accepted" gh issue edit ${{ github.event.issue.number }} --add-label "triage/accepted"
gh issue comment $ISSUE --body "@${{ github.event.comment.user.login }}, this issue has been assigned to you. We are looking forward to your PR!" gh issue edit ${{ github.event.issue.number }} --milestone "$LETASE_MILESTONES"
gh issue comment $ISSUE --body "@${{ github.event.comment.user.login }} Glad to see you accepted this issue🤲, this issue has been assigned to you. <br>I set the milestones for this issue to $LETASE_MILESTONES, we are looking forward to your PR!"
env: env:
GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.REDBOT_GITHUB_TOKEN }}
ISSUE: ${{ github.event.issue.html_url }} ISSUE: ${{ github.event.issue.html_url }}
OWNER: ${{ github.repository_owner }} OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }} REPO: ${{ github.event.repository.name }}

@ -1,26 +1,26 @@
name: Automatic Rebase name: Assign issue to comment author
on: on:
issue_comment: issue_comment:
types: [created] types: [created]
jobs: jobs:
rebase: assign-issue:
name: Rebase if: contains(github.event.comment.body, '/assign') || contains(github.event.comment.body, '/accept')
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: >- permissions:
github.event.issue.pull_request != '' && issues: write
(
contains(github.event.comment.body, '/rebase') ||
contains(github.event.comment.body, '/autosquash')
)
steps: steps:
- name: Checkout the latest code - name: Checkout code
uses: actions/checkout@v3 uses: actions/checkout@v3
with:
token: ${{ secrets.BOT_GITHUB_TOKEN }} - name: Assign the issue
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo run: |
- name: Automatic Rebase export LETASE_MILESTONES=$(curl 'https://api.github.com/repos/kubecub/github-label-syncer/milestones' | jq -r 'last(.[]).title')
uses: cirrus-actions/rebase@1.8 gh issue edit ${{ github.event.issue.number }} --add-assignee "${{ github.event.comment.user.login }}"
with: gh issue edit ${{ github.event.issue.number }} --add-label "triage/accepted"
autosquash: ${{ contains(github.event.comment.body, '/autosquash') || contains(github.event.comment.body, '/rebase-autosquash') }} gh issue edit ${{ github.event.issue.number }} --milestone "$LETASE_MILESTONES"
gh issue comment $ISSUE --body "@${{ github.event.comment.user.login }} Glad to see you accepted this issue🤲, this issue has been assigned to you. I set the milestones for this issue to $LETASE_MILESTONES, We are looking forward to your PR!"
env: env:
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.REDBOT_GITHUB_TOKEN }}
ISSUE: ${{ github.event.issue.html_url }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}

@ -14,13 +14,12 @@ permissions:
env: env:
# Define Open-IM-Server variables here # Define Open-IM-Server variables here
REMOTE_ORGANIZATION: open-im-server OPEN_IM_SERVER_REMOTE_ORGANIZATION: openim-sigs
REMOTE_REPOSITORY: cla REMOTE_REPOSITORY: cla
OPEN_IM_SERVER_CLA_DOCUMENT: https://github.com/openim-sigs/cla/blob/main/README.md OPEN_IM_SERVER_CLA_DOCUMENT: https://github.com/openim-sigs/cla/blob/main/README.md
OPEN_IM_SERVER_SIGNATURES_PATH: signatures/openim-server/cla.json OPEN_IM_SERVER_SIGNATURES_PATH: signatures/${{ github.event.repository.name }}/cla.json
OPEN_IM_SERVER_ALLOWLIST: kubbot,bot* OPEN_IM_SERVER_ALLOWLIST: kubbot,bot*
OPEN_IM_SERVER_REMOTE_ORGANIZATION: openim-sigs
jobs: jobs:
CLAAssistant: CLAAssistant:
@ -40,9 +39,10 @@ jobs:
remote-organization-name: ${{ env.OPEN_IM_SERVER_REMOTE_ORGANIZATION }} remote-organization-name: ${{ env.OPEN_IM_SERVER_REMOTE_ORGANIZATION }}
remote-repository-name: ${{ env.REMOTE_REPOSITORY }} remote-repository-name: ${{ env.REMOTE_REPOSITORY }}
create-file-commit-message: '📚 Docs: Creating file for storing ${{ env.REMOTE_ORGANIZATION }} CLA Signatures'
custom-notsigned-prcomment: '💕 Thank you for your contribution and please kindly read and sign our [🎯https://github.com/openim-sigs/cla/blob/main/README.md](https://github.com/openim-sigs/cla/blob/main/README.md)' create-file-commit-message: '📚 Docs: Creating file for storing ${{ github.event.repository.name }} CLA Signatures'
custom-notsigned-prcomment: '💕 Thank you for your contribution and please kindly read and sign our [🎯https://github.com/openim-sigs/cla/blob/main/README.md](https://github.com/openim-sigs/cla/blob/main/README.md) <br> '
custom-pr-sign-comment: 'I have read the CLA Document and I hereby sign the CLA' custom-pr-sign-comment: 'I have read the CLA Document and I hereby sign the CLA'
custom-allsigned-prcomment: '🤖 All Contributors have signed the ${{ env.REMOTE_ORGANIZATION }} [CLA](https://github.com/openim-sigs/cla/blob/main/README.md).' custom-allsigned-prcomment: '🤖 All Contributors have signed the [${{ github.event.repository.name }} CLA](https://github.com/openim-sigs/cla/blob/main/README.md).<br> The signed information is recorded [🤖here](https://github.com/openim-sigs/cla/tree/main/signatures/${{ env.OPEN_IM_SERVER_ALLOWLIST }}/cla.json)'
# lock-pullrequest-aftermerge: false - if you don't want this bot to automatically lock the pull request after merging (default - true) # lock-pullrequest-aftermerge: false - if you don't want this bot to automatically lock the pull request after merging (default - true)
# use-dco-flag: true - If you are using DCO instead of CLA # use-dco-flag: true - If you are using DCO instead of CLA

@ -31,6 +31,6 @@ jobs:
steps: steps:
- uses: alex-page/github-project-automation-plus@v0.8.3 - uses: alex-page/github-project-automation-plus@v0.8.3
with: with:
project: OpenIM 2023 Sprint 🔥 project: OpenIM-V3.1
column: In Progress column: In Progress
repo-token: ${{ secrets.BOT_GITHUB_TOKEN }} repo-token: ${{ secrets.BOT_GITHUB_TOKEN }}

@ -16,176 +16,142 @@ package wrapperspb
import ( import (
"encoding/base64" "encoding/base64"
"encoding/json"
"errors" "errors"
"strconv" "strconv"
) )
// Double
func Double(value float64) *DoubleValue { func Double(value float64) *DoubleValue {
return &DoubleValue{Value: value} return &DoubleValue{Value: value}
} }
// Float
func Float(value float32) *FloatValue { func Float(value float32) *FloatValue {
return &FloatValue{Value: value} return &FloatValue{Value: value}
} }
// Int64
func Int64(value int64) *Int64Value { func Int64(value int64) *Int64Value {
return &Int64Value{Value: value} return &Int64Value{Value: value}
} }
// UInt64
func UInt64(value uint64) *UInt64Value { func UInt64(value uint64) *UInt64Value {
return &UInt64Value{Value: value} return &UInt64Value{Value: value}
} }
// Int32
func Int32(value int32) *Int32Value { func Int32(value int32) *Int32Value {
return &Int32Value{Value: value} return &Int32Value{Value: value}
} }
// UInt32
func UInt32(value uint32) *UInt32Value { func UInt32(value uint32) *UInt32Value {
return &UInt32Value{Value: value} return &UInt32Value{Value: value}
} }
// Bool
func Bool(value bool) *BoolValue { func Bool(value bool) *BoolValue {
return &BoolValue{Value: value} return &BoolValue{Value: value}
} }
// String
func String(value string) *StringValue { func String(value string) *StringValue {
return &StringValue{Value: value} return &StringValue{Value: value}
} }
// Bytes
func Bytes(value []byte) *BytesValue { func Bytes(value []byte) *BytesValue {
return &BytesValue{Value: value} return &BytesValue{Value: value}
} }
// DoublePtr
func DoublePtr(value *float64) *DoubleValue { func DoublePtr(value *float64) *DoubleValue {
if value == nil { if value == nil {
return nil return nil
} }
return &DoubleValue{Value: *value} return &DoubleValue{Value: *value}
} }
// FloatPtr
func FloatPtr(value *float32) *FloatValue { func FloatPtr(value *float32) *FloatValue {
if value == nil { if value == nil {
return nil return nil
} }
return &FloatValue{Value: *value} return &FloatValue{Value: *value}
} }
// Int64Ptr
func Int64Ptr(value *int64) *Int64Value { func Int64Ptr(value *int64) *Int64Value {
if value == nil { if value == nil {
return nil return nil
} }
return &Int64Value{Value: *value} return &Int64Value{Value: *value}
} }
// UInt64Ptr
func UInt64Ptr(value *uint64) *UInt64Value { func UInt64Ptr(value *uint64) *UInt64Value {
if value == nil { if value == nil {
return nil return nil
} }
return &UInt64Value{Value: *value} return &UInt64Value{Value: *value}
} }
// Int32Ptr
func Int32Ptr(value *int32) *Int32Value { func Int32Ptr(value *int32) *Int32Value {
if value == nil { if value == nil {
return nil return nil
} }
return &Int32Value{Value: *value} return &Int32Value{Value: *value}
} }
// UInt32Ptr
func UInt32Ptr(value *uint32) *UInt32Value { func UInt32Ptr(value *uint32) *UInt32Value {
if value == nil { if value == nil {
return nil return nil
} }
return &UInt32Value{Value: *value} return &UInt32Value{Value: *value}
} }
// BoolPtr
func BoolPtr(value *bool) *BoolValue { func BoolPtr(value *bool) *BoolValue {
if value == nil { if value == nil {
return nil return nil
} }
return &BoolValue{Value: *value} return &BoolValue{Value: *value}
} }
// StringPtr
func StringPtr(value *string) *StringValue { func StringPtr(value *string) *StringValue {
if value == nil { if value == nil {
return nil return nil
} }
return &StringValue{Value: *value} return &StringValue{Value: *value}
} }
// BytesPtr
func BytesPtr(value *[]byte) *BytesValue { func BytesPtr(value *[]byte) *BytesValue {
if value == nil { if value == nil {
return nil return nil
} }
return &BytesValue{Value: *value} return &BytesValue{Value: *value}
} }
// UnmarshalJSON
func (m *DoubleValue) UnmarshalJSON(p []byte) error { func (m *DoubleValue) UnmarshalJSON(p []byte) error {
value, err := strconv.ParseFloat(string(p), 64) value, err := strconv.ParseFloat(string(p), 64)
if err != nil { if err != nil {
return err return err
} }
m.Value = value m.Value = value
return nil return nil
} }
// MarshalJSON
func (m *DoubleValue) MarshalJSON() ([]byte, error) { func (m *DoubleValue) MarshalJSON() ([]byte, error) {
return []byte(strconv.FormatFloat(m.Value, 'f', -1, 64)), nil return []byte(strconv.FormatFloat(m.Value, 'f', -1, 64)), nil
} }
// UnmarshalJSON
func (m *FloatValue) UnmarshalJSON(p []byte) error { func (m *FloatValue) UnmarshalJSON(p []byte) error {
value, err := strconv.ParseFloat(string(p), 64) value, err := strconv.ParseFloat(string(p), 64)
if err != nil { if err != nil {
return err return err
} }
m.Value = float32(value) m.Value = float32(value)
return nil return nil
} }
// MarshalJSON
func (m *FloatValue) MarshalJSON() ([]byte, error) { func (m *FloatValue) MarshalJSON() ([]byte, error) {
return []byte(strconv.FormatFloat(float64(m.Value), 'f', -1, 32)), nil return []byte(strconv.FormatFloat(float64(m.Value), 'f', -1, 32)), nil
} }
// UnmarshalJSON
func (m *Int64Value) UnmarshalJSON(p []byte) error { func (m *Int64Value) UnmarshalJSON(p []byte) error {
value, err := strconv.ParseInt(string(p), 10, 64) value, err := strconv.ParseInt(string(p), 10, 64)
if err != nil { if err != nil {
return err return err
} }
m.Value = value m.Value = value
return nil return nil
} }
@ -193,86 +159,66 @@ func (m *Int64Value) MarshalJSON() ([]byte, error) {
return []byte(strconv.FormatInt(m.Value, 10)), nil return []byte(strconv.FormatInt(m.Value, 10)), nil
} }
// UnmarshalJSON
func (m *UInt64Value) UnmarshalJSON(p []byte) error { func (m *UInt64Value) UnmarshalJSON(p []byte) error {
value, err := strconv.ParseUint(string(p), 10, 64) value, err := strconv.ParseUint(string(p), 10, 64)
if err != nil { if err != nil {
return err return err
} }
m.Value = value m.Value = value
return nil return nil
} }
// MarshalJSON
func (m *UInt64Value) MarshalJSON() ([]byte, error) { func (m *UInt64Value) MarshalJSON() ([]byte, error) {
return []byte(strconv.FormatUint(m.Value, 10)), nil return []byte(strconv.FormatUint(m.Value, 10)), nil
} }
// UnmarshalJSON
func (m *Int32Value) UnmarshalJSON(p []byte) error { func (m *Int32Value) UnmarshalJSON(p []byte) error {
value, err := strconv.ParseInt(string(p), 10, 32) value, err := strconv.ParseInt(string(p), 10, 32)
if err != nil { if err != nil {
return err return err
} }
m.Value = int32(value) m.Value = int32(value)
return nil return nil
} }
// MarshalJSON
func (m *Int32Value) MarshalJSON() ([]byte, error) { func (m *Int32Value) MarshalJSON() ([]byte, error) {
return []byte(strconv.FormatInt(int64(m.Value), 10)), nil return []byte(strconv.FormatInt(int64(m.Value), 10)), nil
} }
// UnmarshalJSON
func (m *UInt32Value) UnmarshalJSON(p []byte) error { func (m *UInt32Value) UnmarshalJSON(p []byte) error {
value, err := strconv.ParseUint(string(p), 10, 32) value, err := strconv.ParseUint(string(p), 10, 32)
if err != nil { if err != nil {
return err return err
} }
m.Value = uint32(value) m.Value = uint32(value)
return nil return nil
} }
// MarshalJSON
func (m *UInt32Value) MarshalJSON() ([]byte, error) { func (m *UInt32Value) MarshalJSON() ([]byte, error) {
return []byte(strconv.FormatUint(uint64(m.Value), 10)), nil return []byte(strconv.FormatUint(uint64(m.Value), 10)), nil
} }
// UnmarshalJSON
func (m *BoolValue) UnmarshalJSON(p []byte) error { func (m *BoolValue) UnmarshalJSON(p []byte) error {
value, err := strconv.ParseBool(string(p)) value, err := strconv.ParseBool(string(p))
if err != nil { if err != nil {
return err return err
} }
m.Value = value m.Value = value
return nil return nil
} }
// MarshalJSON
func (m *BoolValue) MarshalJSON() ([]byte, error) { func (m *BoolValue) MarshalJSON() ([]byte, error) {
return []byte(strconv.FormatBool(m.Value)), nil return []byte(strconv.FormatBool(m.Value)), nil
} }
// UnmarshalJSON
func (m *StringValue) UnmarshalJSON(p []byte) error { func (m *StringValue) UnmarshalJSON(p []byte) error {
if len(p) < 2 || p[0] != '"' || p[len(p)-1] != '"' { return json.Unmarshal(p, &m.Value)
return errors.New("invalid string value")
}
m.Value = string(p[1 : len(p)-1])
return nil
} }
// MarshalJSON
func (m *StringValue) MarshalJSON() ([]byte, error) { func (m *StringValue) MarshalJSON() ([]byte, error) {
return []byte(`"` + m.Value + `"`), nil return json.Marshal(m.Value)
} }
// UnmarshalJSON
func (m *BytesValue) UnmarshalJSON(p []byte) error { func (m *BytesValue) UnmarshalJSON(p []byte) error {
if len(p) < 2 || p[0] != '"' || p[len(p)-1] != '"' { if len(p) < 2 || p[0] != '"' || p[len(p)-1] != '"' {
return errors.New("invalid bytes value") return errors.New("invalid bytes value")
@ -282,48 +228,38 @@ func (m *BytesValue) UnmarshalJSON(p []byte) error {
return err return err
} }
m.Value = value m.Value = value
return nil return nil
} }
// MarshalJSON
func (m *BytesValue) MarshalJSON() ([]byte, error) { func (m *BytesValue) MarshalJSON() ([]byte, error) {
return []byte(`"` + base64.StdEncoding.EncodeToString(m.Value) + `"`), nil return []byte(`"` + base64.StdEncoding.EncodeToString(m.Value) + `"`), nil
} }
// GetValuePtr
func (m *DoubleValue) GetValuePtr() *float64 { func (m *DoubleValue) GetValuePtr() *float64 {
if m == nil { if m == nil {
return nil return nil
} }
return &m.Value return &m.Value
} }
// GetValuePtr
func (m *FloatValue) GetValuePtr() *float32 { func (m *FloatValue) GetValuePtr() *float32 {
if m == nil { if m == nil {
return nil return nil
} }
return &m.Value return &m.Value
} }
// GetValuePtr
func (m *Int64Value) GetValuePtr() *int64 { func (m *Int64Value) GetValuePtr() *int64 {
if m == nil { if m == nil {
return nil return nil
} }
return &m.Value return &m.Value
} }
// GetValuePtr
func (m *UInt64Value) GetValuePtr() *uint64 { func (m *UInt64Value) GetValuePtr() *uint64 {
if m == nil { if m == nil {
return nil return nil
} }
return &m.Value return &m.Value
} }
@ -331,11 +267,9 @@ func (m *Int32Value) GetValuePtr() *int32 {
if m == nil { if m == nil {
return nil return nil
} }
return &m.Value return &m.Value
} }
// GetValuePtr
func (m *UInt32Value) GetValuePtr() *uint32 { func (m *UInt32Value) GetValuePtr() *uint32 {
if m == nil { if m == nil {
return nil return nil
@ -343,29 +277,23 @@ func (m *UInt32Value) GetValuePtr() *uint32 {
return &m.Value return &m.Value
} }
// GetValuePtr
func (m *BoolValue) GetValuePtr() *bool { func (m *BoolValue) GetValuePtr() *bool {
if m == nil { if m == nil {
return nil return nil
} }
return &m.Value return &m.Value
} }
// GetValuePtr
func (m *StringValue) GetValuePtr() *string { func (m *StringValue) GetValuePtr() *string {
if m == nil { if m == nil {
return nil return nil
} }
return &m.Value return &m.Value
} }
// GetValuePtr
func (m *BytesValue) GetValuePtr() *[]byte { func (m *BytesValue) GetValuePtr() *[]byte {
if m == nil { if m == nil {
return nil return nil
} }
return &m.Value return &m.Value
} }

Loading…
Cancel
Save