Pagination added, take, skip
5 unresolved threads
5 unresolved threads
Pagination added, take, skip
Pagination added, take, skip
Sample Codes (Collection)
items := &[]string{
"00",
"01",
"02",
"03",
"04",
"05",
"06",
"07",
"08",
"09",
"10",
"11",
"12",
}
collection := corestr.NewCollectionUsingStrings(items, false)
fmt.Println(collection.GetPagedCollection(3).String())
GOROOT=D:\Go #gosetup
GOPATH=D:\github\go-workspace #gosetup
D:\Go\bin\go.exe build -o C:\Users\Administrator\AppData\Local\Temp\___go_build_gitlab_com_evatix_go_core_cmd_main.exe gitlab.com/evatix-go/core/cmd/main #gosetup
C:\Users\Administrator\AppData\Local\Temp\___go_build_gitlab_com_evatix_go_core_cmd_main.exe #gosetup
# Summary of `*corestr.Collection`, Length ("3") - Sequence `1`
- 01
- 02
- 03
# Summary of `*corestr.Collection`, Length ("3") - Sequence `2`
- 04
- 05
- 06
# Summary of `*corestr.Collection`, Length ("3") - Sequence `3`
- 07
- 08
- 09
# Summary of `*corestr.Collection`, Length ("3") - Sequence `4`
- 10
- 11
- 12
Process finished with exit code 0
CollectionPtr
go
items := &[]string{
"00",
"01",
"02",
"03",
"04",
"05",
"06",
"07",
"08",
"09",
"10",
"11",
"12",
}
collection := corestr.NewCollectionPtrUsingStrings(items, 0)
fmt.Println(collection.GetPagedCollection(3).String())
Edited by Md. Alim Ul Karim
Merge request reports
Activity
requested review from @aukgit.evatix and removed review request for @nafrose
mentioned in commit 6f8235f8
mentioned in commit f64d4099
607 616 return (*collection.items)[0] 608 617 } 609 618 610 func (collection *Collection) AddStringsPtr(stringItems *[]string) *Collection { 619 // use One based index 620 func (collection *Collection) Take( 621 take int, 622 ) *Collection { 623 length := collection.Length() 624 625 if length <= take || take == 0 { 626 return collection 627 } 628 629 list := (*collection.items)[:take+1] 607 616 return (*collection.items)[0] 608 617 } 609 618 610 func (collection *Collection) AddStringsPtr(stringItems *[]string) *Collection { 619 // use One based index 620 func (collection *Collection) Take( 621 take int, 622 ) *Collection { 623 length := collection.Length() 624 625 if length <= take || take == 0 { 626 return collection - Resolved by Naureen Afrose
683 684 if length < eachPageSize { 685 return NewCollectionsOfCollectionUsingStrings( 686 collection.items, false) 687 } 688 689 pagesPossibleFloat := float64(length) / float64(eachPageSize) 690 pagesPossibleCeiling := int(math.Ceil(pagesPossibleFloat)) 691 collectionOfCollection := NewCollectionsOfCollection( 692 pagesPossibleCeiling) 693 694 for i := 1; i <= pagesPossibleCeiling; i++ { 695 pagedCollection := collection.GetSinglePageCollection( 696 eachPageSize, i) 697 698 if i >= pagesPossibleCeiling && pagedCollection.IsEmpty() { My query was about the first part
Edited by Naureen Afrose
819 capacity) 789 820 790 821 return &CollectionsOfCollection{ 791 822 items: &collection, 792 823 } 793 824 } 825 826 // --------- CollectionsOfCollectionPtr starts ---------- 827 828 func NewCollectionsOfCollectionPtr( 829 capacity int, 830 ) *CollectionsOfCollectionPtr { 831 collection := make( 832 []*CollectionPtr, 833 constants.Zero, 834 capacity) 634 } 635 636 // use One based index 637 func (collection *Collection) Skip( 638 skip int, 639 ) *Collection { 640 length := collection.Length() 641 642 if length < skip { 643 msgtype. 644 LengthShouldBeEqualToMessage. 645 HandleUsingPanic( 646 "Length is lower than skip value. Skip:", 647 skip) 648 } 649 if skip < 0 { newline before
Edited by Md. Alim Ul Karim
Please register or sign in to reply