Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(‎container/garray): Sorted T Array#4470

Merged
hailaz merged 26 commits intomasterfrom
feat/SortedTArray
Oct 17, 2025
Merged

feat(‎container/garray): Sorted T Array#4470
hailaz merged 26 commits intomasterfrom
feat/SortedTArray

Conversation

@joy999
Copy link
Contributor

@joy999 joy999 commented Oct 15, 2025

Add the sorted T array

@hailaz hailaz requested a review from Copilot October 15, 2025 09:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds generic sorted array functionality with type parameters to the GoFrame library. It introduces a new SortedTArray type that provides type-safe sorted array operations.

  • Adds new generic SortedTArray[T] type with comprehensive methods for sorted array operations
  • Introduces new generic comparator functions in gutil package for type safety
  • Updates existing generic helper functions to accept broader any constraint instead of comparable

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
util/gutil/gutil_comparator.go Adds generic comparators ComparatorT and ComparatorTStr for type-safe comparisons
container/garray/garray_sorted_t.go Implements the main SortedTArray[T] type with all sorted array operations
container/garray/garray_z_unit_sorted_t_test.go Comprehensive unit tests for the new SortedTArray functionality
container/garray/garray_z_example_sorted_t_test.go Example usage tests demonstrating SortedTArray features
container/garray/garray_func.go Updates generic helper functions to use any constraint for broader compatibility

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@joy999 joy999 requested a review from Copilot October 15, 2025 09:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@joy999 joy999 added the feature label Oct 15, 2025
@joy999 joy999 added the done This issue is done, which may be release in next version. label Oct 16, 2025
@joy999 joy999 requested a review from Copilot October 16, 2025 02:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@joy999 joy999 removed the done This issue is done, which may be release in next version. label Oct 16, 2025
@joy999 joy999 requested a review from Copilot October 16, 2025 02:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@joy999 joy999 requested a review from Copilot October 16, 2025 06:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@joy999 joy999 requested a review from Copilot October 16, 2025 06:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@joy999 joy999 requested a review from Copilot October 16, 2025 07:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@joy999 joy999 added the done This issue is done, which may be release in next version. label Oct 16, 2025
@joy999 joy999 requested a review from Copilot October 16, 2025 07:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@joy999 joy999 requested a review from Copilot October 16, 2025 07:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

joy999 and others added 2 commits October 17, 2025 11:11
- 将 SortedArray / SortedIntArray / SortedStrArray 从值嵌入改为嵌入 *SortedTArray[T]
- 为各类型增加 lazyInit 方法,在需要时懒初始化底层 SortedTArray(并为 int/str 设置默认 comparator 与 sorter)
- 在大量方法入口增加 lazyInit 调用,避免未初始化指针导致的空引用
- 调整构造、Clone、DeepCopy、Marshal/Unmarshal 等实现以适配指针类型
- 修改测试用例中相关用法(例如将结构体字段改为 *SortedTArray[int],去除对按值数组的取值)
- 清理 sorted_any.go 中未使用的导入

此改动使 Typed SortedArray 支持延迟初始化并减少复制开销,提升使用健壮性与一致性。
@hailaz hailaz changed the title Feat/sorted t array feat(‎container/garray): array for T Oct 17, 2025
@hailaz hailaz requested a review from Copilot October 17, 2025 09:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@hailaz hailaz changed the title feat(‎container/garray): array for T feat(‎container/garray): Sorted T Array Oct 17, 2025
@hailaz hailaz merged commit c02148c into master Oct 17, 2025
20 checks passed
@hailaz hailaz deleted the feat/SortedTArray branch October 17, 2025 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

done This issue is done, which may be release in next version. feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants