Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hrz8/lets-go-seeds
https://github.com/hrz8/lets-go-seeds
algorithms anagram go refactoring sql tech-assessment
Last synced: 3 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/hrz8/lets-go-seeds
- Owner: hrz8
- Created: 2021-10-11T08:00:42.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2021-10-11T09:08:46.000Z (about 3 years ago)
- Last Synced: 2024-06-19T17:57:38.723Z (5 months ago)
- Topics: algorithms, anagram, go, refactoring, sql, tech-assessment
- Language: Go
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# lets-go-bibit
## What's going on here?
- [DB Query](#01_Simple-Database-Query)
- [OMDB API](#02_OMDB-API)
- [Refactor](#03_Refactor)
- [Logic](#04_Logic)## 01_Simple-Database-Query
```sql
# Create Users Table
CREATE TABLE Users (
ID int NOT NULL PRIMARY KEY AUTO_INCREMENT,
UserName nvarchar(255) NOT NULL,
Parent int NULL
);
ALTER TABLE Users ADD FOREIGN KEY (Parent) REFERENCES Users (ID);# Query for Select User and ParentName
SELECT
child.ID,
child.UserName,
COALESCE(parent.UserName, NULL) as 'ParentName'
FROM Users child
LEFT JOIN Users parent ON (child.Parent = parent.ID);
```## 02_OMDB-API
> Movies Microservices TaskRepository: https://github.com/hrz8/go-seeding-omdb
## 03_Refactor
> Refactor the function```go
func FindFirstStringInBracket(str string) string {
indexFirstBracketFound := strings.Index(str, "(")
if len(str) == 0 || indexFirstBracketFound < 0 {
return ""
}
strRunes := []rune(str)
wordsAfterFirstBracket := string(strRunes[indexFirstBracketFound:len(str)])
indexClosingBracketFound := strings.Index(wordsAfterFirstBracket, ")")
if indexClosingBracketFound < 0 {
return ""
}
afterBracketRunes := []rune(wordsAfterFirstBracket)
return strings.Split(string(afterBracketRunes[1:indexClosingBracketFound]), " ")[0]
}
```
### Play the Game```bash
[lets-go-bibit]$ cd 03_Refactor/
[04_Logic]$ go test *.go
```## 04_Logic
> Write a function to grouping list of string given based on anagram.
### Play the Game
```bash
[lets-go-bibit]$ cd 04_Logic/
[04_Logic]$ go run main.go
```