{"id":21270895,"url":"https://github.com/timothyl96/goo","last_synced_at":"2025-07-11T05:32:20.371Z","repository":{"id":59613634,"uuid":"537896381","full_name":"TimothyL96/goo","owner":"TimothyL96","description":"Go standard library with extension - OOP style","archived":false,"fork":false,"pushed_at":"2024-11-05T16:28:22.000Z","size":317,"stargazers_count":0,"open_issues_count":9,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-05T17:33:12.510Z","etag":null,"topics":["extension","go","go-method","golang","library","linq","object-oriented-programming","oop"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TimothyL96.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-17T18:26:16.000Z","updated_at":"2022-09-28T18:00:22.000Z","dependencies_parsed_at":"2023-11-09T01:30:38.196Z","dependency_job_id":"74df3d62-ccf0-487e-ad75-8f89b0cd48ff","html_url":"https://github.com/TimothyL96/goo","commit_stats":{"total_commits":152,"total_committers":5,"mean_commits":30.4,"dds":0.08552631578947367,"last_synced_commit":"16149e14f6d003723c308b0ff7089e0816f56080"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimothyL96%2Fgoo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimothyL96%2Fgoo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimothyL96%2Fgoo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimothyL96%2Fgoo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TimothyL96","download_url":"https://codeload.github.com/TimothyL96/goo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225694415,"owners_count":17509342,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["extension","go","go-method","golang","library","linq","object-oriented-programming","oop"],"created_at":"2024-11-21T08:19:01.949Z","updated_at":"2024-11-21T08:19:02.517Z","avatar_url":"https://github.com/TimothyL96.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# $$\\textcolor{yellow}{\\text{GOO}}$$\n\n## **G**olang standard library Extension + the **OO** way\n\n\u003cbr\u003e\n\n\u003e The library you never knew you needed :speak_no_evil:\n\n\u003cbr\u003e\n\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/26b98e19151f471fbd3729dbbe56c2d8)](https://www.codacy.com/gh/TimothyL96/goo/dashboard?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=TimothyL96/goo\u0026amp;utm_campaign=Badge_Grade)\n[![Maintainability](https://api.codeclimate.com/v1/badges/bbc9b7ccb927732ec239/maintainability)](https://codeclimate.com/github/TimothyL96/goo/maintainability)\n[![CodeFactor](https://www.codefactor.io/repository/github/timothyl96/goo/badge)](https://www.codefactor.io/repository/github/timothyl96/goo)\n[![Go Report Card](https://goreportcard.com/badge/github.com/timothyl96/goo)](https://goreportcard.com/report/github.com/timothyl96/goo)\n[![Go Reference](https://pkg.go.dev/badge/github.com/timothyl96/goo.svg)](https://pkg.go.dev/github.com/timothyl96/goo#section-documentation)\n\n[![CircleCI](https://img.shields.io/circleci/build/github/TimothyL96/goo?label=circleci\u0026logo=circleci)](https://dl.circleci.com/status-badge/redirect/gh/TimothyL96/goo/tree/master)\n[![Travis Build Status](https://img.shields.io/travis/com/TimothyL96/goo?logo=travis\u0026label=travis-ci)](https://app.travis-ci.com/TimothyL96/goo)\n[![DeepSource](https://deepsource.io/gh/TimothyL96/goo.svg/?label=active+issues\u0026show_trend=true\u0026token=lc6AhgyQ_EjizXaVrr2ehW_K)](https://deepsource.io/gh/TimothyL96/goo/?ref=repository-badge)\n\n[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/26b98e19151f471fbd3729dbbe56c2d8)](https://www.codacy.com/gh/TimothyL96/goo/dashboard?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=TimothyL96/goo\u0026utm_campaign=Badge_Coverage)\n[![codecov](https://codecov.io/gh/TimothyL96/goo/branch/master/graph/badge.svg?token=o61pQVm2m9)](https://codecov.io/gh/TimothyL96/goo)\n![GitHub](https://img.shields.io/github/license/TimothyL96/goo)\n\n\u003cbr\u003e\n\nThere are 2 ways to use this library :bulb:\n\n1. Use the methods added to '_builtin_' types so we can simplify calling functions in OO way.\n\n    This includes builtin + extended functions like `unique()`.\n\n 2. :exclamation: Or, simply apply the extended functions in Go style.\n\n\u003cbr\u003e\n\nExample - Extended functions in Go Style:\n\n```Go\nmyInts := []int{1, 1, 1, 2, 3, 3}\ngoo.Unique(myInts) // returns {1, 2, 3}\n\n// With String\nmyStrs := []string{\"a\", \"a\", \"b\", \"b\", \"b\", \"b\", \"c\"}\ngoo.Unique(myStrs) // returns {a, b, c}\n\n// ForEach\ngoo.ForEach(myInts, func(i int) { fmt.Println(i) })\n```\n\n\u003cbr\u003e\n\nYou can also use it in OOP style.\n\nExample:\n\n```Go\n// ##### Example:\n// ### Length:\nstr1 := goo.FromString(\"myString\")\nstr1.length() // same as len(str1)\n\n// ### Arithmetic and Itoa()\ni1 := goo.FromInt(30)\ni1 += 20\ni1.Itoa() // same as strconv.Itoa(i1)\n\n// ### ToUpper():\nvar str2 goo.String = \"myuppercasestring\"\nstr2.ToUpper() // same as strings.ToUpper(str2)\n\n// ##### Slice\n// ### Append()\ns1 := goo.NewSlice(1, 2, 3)\ns1 = s1.Append(4, 5, 6) // same as s1 = append(s1, 4, 5, 6)\n\n// ##### Extension library example:\n// ### Unique()\ns2 := goo.NewSlice(1, 1, 2, 3, 3)\ns2 = s2.Unique() // == [1, 2, 3]\n\n// ### ForEach()\ns3 := goo.NewSlice(1, 2, 3)\ns3 = s3.ForEach(func(i int) { fmt.Println(i) }) // Prints each 1,2,3 in new line\n\n// ### HasAnyPrefix()\ns4 := goo.FromString(\"-abcdef\")\n_ = s4.HasAnyPrefix(\"x\", \"'\", \"=\", \"-\") // == true\n\n```\n\n\u003cbr\u003e\n\nIf typing `goo.` is too much, use dot import for this library:\n\n```Go\nimport (\n\t. \"github.com/timothyl96/goo\"\n)\n```\n\n\u003cbr\u003e\n\n:question::grey_question: How to declare a variable:\n\n```Go\n// Using Goo function\nt1 := goo.FromString(\"myString\")\n\n// Using default = operator, but explicitly specify the type\nvar t2 goo.Int = 30\n\n// Using explicit type conversion\nt3 := goo.Int(2) \n\n\n// ### Declaring Slice\n// Using NewSlice which returns a goo.Slice (recommended)\nmySlice := goo.NewSlice(1, 2, 3)\n\n// Using Goo function with Int\nt5 := goo.FromSlice([]goo.Int{1, 2, 3})\n\n// Using default = operation, but explicitly specify the type for the generic\nvar t6 goo.Slice[int] = []int{1, 2, 3}\n\n// ### Declaring Map\n// Capacity of 1, key int, value int - Recommended\nt8 := goo.NewMap[int, int](1)\nt8[1] = 1\n\n// Convert from builtin map\nt9 := goo.FromMap(make(map[int]int))\n\n// or using var keyword\nvar t9 goo.Map[int, struct{}] = make(map[int]struct{})\n```\n\n\u003cbr\u003e\n\nMore:\n\nHow to use Goo:\n[GOO Example](https://github.com/TimothyL96/goo-example)\n\n\u003cbr\u003e\n\n---  \n\n## \u003cb\u003eBenchmark\u003c/b\u003e :clock330:\n\nThe result below shows that the performances are similar when compared to builtin functions.\n\n![Benchmarking result](https://github.com/TimothyL96/goo/blob/master/images/benchmark.jpg?raw=true)\n\n\u003cbr\u003e\n\n---  \n\n## \u003cb\u003eRunning the source code\u003c/b\u003e :runner:\n\nThere are 3 useful commands: \n\nRun `go generate` for code generation :point_right: `go generate ./...`\n    \n- This will generate most of the goo types e.g. string.go, int.go\n- Check the gen/ folder for more information\n\nRun `go test` :point_right: `go test -v ./...`\n\nRun `go benchmark` :point_right: `go test -bench=Bench -run Bench -benchmem -benchtime 10s -v ./...`\n\n\u003cbr\u003e\n\n---  \n\n## \u003cb\u003eContributing\u003c/b\u003e :memo:\nFeel free to raise issue or PR\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimothyl96%2Fgoo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimothyl96%2Fgoo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimothyl96%2Fgoo/lists"}