Skip to content

Commit

Permalink
Merge pull request #1 from Diaszano/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
Diaszano authored Dec 16, 2024
2 parents a5f2009 + 5a2e08d commit 590c61f
Show file tree
Hide file tree
Showing 7 changed files with 646 additions and 3 deletions.
87 changes: 87 additions & 0 deletions .github/assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Go Test

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.23

- name: Install dependencies
run: go mod tidy

- name: Run tests
run: go test ./... -v
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ go.work.sum
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
Expand Down Expand Up @@ -282,4 +283,3 @@ fabric.properties

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

23 changes: 23 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.5.1
hooks:
- id: go-fmt
- id: go-vet
- id: go-imports
- id: go-cyclo
args: [-over=15]
- id: validate-toml
- id: no-go-testing
- id: golangci-lint
- id: go-critic
- id: go-unit-tests
- id: go-build
- id: go-mod-tidy
157 changes: 155 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,155 @@
# strrand
A simple and efficient library written in Go (Golang) for generating customizable random strings.
<header>
<div align="center">

<a href="https://github.com/Diaszano">
<img src=".github/assets/logo.svg" alt="logo" height="150">
</a>

<h1>strrand</h1>

<p>A simple and efficient library written in Go (Golang) for generating customizable random strings.</p>

</div>
</header>

# Introduction

The **strrand** library is designed to simplify the generation of random strings quickly, efficiently, and hassle-free. Moreover, it has no external dependencies, ensuring lightweight and easy integration into your Go projects.

## Installation

To install the library, simply run the command below:

```shell
go get github.com/Diaszano/strrand
```

## Usage

Using **strrand** is very intuitive. Check out some practical examples below to get started:

### Generate Binary Strings
```go
package main

import (
"fmt"

"github.com/Diaszano/strrand"
)

func main() {
for range 3 {
str := strrand.Binary(10)
fmt.Println(str)
}
}

// Example output:
// 0111110101
// 0101111110
// 0110000001
```

### Generate Hexadecimal Strings
```go
package main

import (
"fmt"

"github.com/Diaszano/strrand"
)

func main() {
for range 3 {
str := strrand.Hexadecimal(10)
fmt.Println(str)
}
}

// Example output:
// 8a72bc19a7
// 652bac2a41
// 75ff495c77
```

### Generate Base62 Strings
```go
package main

import (
"fmt"

"github.com/Diaszano/strrand"
)

func main() {
for range 3 {
str := strrand.Base62(10)
fmt.Println(str)
}
}

// Example output:
// Nwc5Q0ARc4
// 6D1RLHU4eL
// 8djCoMKfh8
```

### Generate Strings with Random Characters (Default)
```go
package main

import (
"fmt"

"github.com/Diaszano/strrand"
)

func main() {
for range 3 {
str := strrand.String(10)
fmt.Println(str)
}
}

// Example output:
// %`'s72,6;3
// gt)Dn5rNZi
// @AH!=qk^R8
```

### Generate Custom Strings
You can specify a custom character set for string generation:

```go
package main

import (
"fmt"

"github.com/Diaszano/strrand"
)

func main() {
charset := "abcd12345"
for range 3 {
str := strrand.String(10, charset)
fmt.Println(str)
}
}

// Example output:
// 4b42233cc3
// ba4c41c2c2
// 345d4acd51
```

## Contribution

Contributions are welcome! If you find any issues, have suggestions, or want to collaborate with improvements, feel free to open an [issue](https://github.com/Diaszano/strrand/issues) or submit a pull request.

---

**License:** This project is licensed under the [MIT License](https://opensource.org/licenses/MIT).
Loading

0 comments on commit 590c61f

Please sign in to comment.