Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
160 changes: 160 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# ValidGen

<img align="right" width="250px" src="static/assets/go_logo.png">



**Valigen** is a Go library for generating and validating various types of structured data, such as Brazilian CPF, CNPJ, and other formatted identifiers. It provides an efficient and easy-to-use API to handle data validation, formatting, and generation.

If you need a reliable solution for working with structured data, **Valigen** is the perfect choice.

## Key Features

- **Data Generation** – Generate valid CPF, CNPJ, and other structured identifiers.
- **Validation** – Easily check if a given value is correctly formatted and valid.
- **Formatting & Unformatting** – Convert data between formatted and raw versions.
- **Flexible & Extensible** – Supports multiple data types and validation rules.
- **User-Friendly API** – Simple and intuitive integration with any Go project.
- **High Performance** – Optimized for speed and efficiency.

For more details and usage examples, check out the **Valigen** repository.

## **Installation**

To install the ValidGen package, use the following command:

```sh
go get github.com/Hublastt/ValidGen
```

## Usage

Below are examples of how to use the various functions provided by the ValidGen package.

<details>
<summary>Validate CPF</summary>

To validate a CPF number:

```go
package main

import (
"fmt"
"github.com/Hublastt/ValidGen/validgen"
)

func main() {
err := validgen.ValidateCPF("12345678909")
if err != nil {
fmt.Println("Invalid CPF:", err)
} else {
fmt.Println("CPF is valid")
}
}
```
</details>

<details>
<summary>Generate CPF</summary>

To generate a valid CPF number:

```go
package main

import (
"fmt"
"github.com/Hublastt/ValidGen/validgen"
)

func main() {
cpf, err := validgen.GenerateCPF()
if err != nil {
fmt.Println("Error generating CPF:", err)
} else {
fmt.Println("Generated CPF:", cpf)
}
}
```
</details>

<details>
<summary>Format CPF</summary>

To format a CPF number:

```go
package main

import (
"fmt"
"github.com/Hublastt/ValidGen/validgen"
)

func main() {
formattedCPF, err := validgen.FormatCPF("12345678909")
if err != nil {
fmt.Println("Error formatting CPF:", err)
} else {
fmt.Println("Formatted CPF:", formattedCPF)
}
}
```
</details>

<details>
<summary>Unformat CPF</summary>

To unformat a CPF number:

```go
package main

import (
"fmt"
"github.com/Hublastt/ValidGen/validgen"
)

func main() {
unformattedCPF, err := validgen.UnformatCPF("123.456.789-09")
if err != nil {
fmt.Println("Error unformatting CPF:", err)
} else {
fmt.Println("Unformatted CPF:", unformattedCPF)
}
}
```
</details>

<details>
<summary>Format Generated CPF</summary>

To format a generated CPF number:

```go
package main

import (
"fmt"
"github.com/Hublastt/ValidGen/validgen"
)

func main() {
formattedGeneratedCPF, err := validgen.FormatGeneratedCPF()
if err != nil {
fmt.Println("Error formatting generated CPF:", err)
} else {
fmt.Println("Formatted Generated CPF:", formattedGeneratedCPF)
}
}
```
</details>

## Contributing

Contributions are welcome! If you would like to contribute, feel free to open a pull request.

## License

This project is licensed under the MIT License.
Binary file added static/assets/go_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.