Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/DGKSK8LIFE/redisql
SQL to Redis caching made easy
https://github.com/DGKSK8LIFE/redisql
go golang hacktoberfest hacktoberfest2021 mysql postgres redis sql
Last synced: 3 months ago
JSON representation
SQL to Redis caching made easy
- Host: GitHub
- URL: https://github.com/DGKSK8LIFE/redisql
- Owner: DGKSK8LIFE
- License: mit
- Created: 2021-06-19T19:20:09.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-11-29T00:23:38.000Z (almost 3 years ago)
- Last Synced: 2024-06-20T14:19:16.286Z (5 months ago)
- Topics: go, golang, hacktoberfest, hacktoberfest2021, mysql, postgres, redis, sql
- Language: Go
- Homepage: https://dev.to/tarekali/how-i-solved-mysql-to-redis-caching-with-go-3lf7
- Size: 895 KB
- Stars: 64
- Watchers: 6
- Forks: 14
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
---
## Example Usage
## CLI
### Installation and Configuration:
```bash
go install github.com/DGKSK8LIFE/redisql/redisql
```Create a YAML file with the following structure:
```yaml
sqltype:
sqluser:
sqlpassword:
sqldatabase:
sqlhost:
sqlport:
sqltable:
redisaddr:
redispass:
log_level:
log_filenane:
```
(`log_level` and `log_filename` are optional. Default logging is none and default output is `stdout`)Logging Levels:
- `0` - no logging at all
- `1` - summary of actions being performed by redisql
- `2` - all actions (including individual keys and their values being performed by redisql### Usage:
```bash
# copy to redis string
redisql copy -type=string -config=pathtofile.yml# copy to redis list
redisql copy -type=list -config=pathtofile.yml# copy to redis hash
redisql copy -type=hash -config=pathtofile.yml
```## Library
### Installation:
```bash
go get github.com/DGKSK8LIFE/redisql
```
### Usage:```go
package mainimport (
"github.com/DGKSK8LIFE/redisql"
)func main() {
config := redisql.Config{
SQLType: "mysql",
SQLUser: "root",
SQLPassword: "password",
SQLDatabase: "users",
SQLHost: "localhost",
SQLPort: "3306",
SQLTable: "user",
RedisAddr: "localhost:6379",
RedisPass: "",
}
err := config.CopyToString()
if err != nil {
panic(err)
}
}
```### Other Methods:
```go
// copy to redis list
config.CopyToList()// copy to redis hash
config.CopyToHash()
```## Contributing
Check out [CONTRIBUTING](CONTRIBUTING.md)
## Current Functionality and Limitations
- [x] Copying of entire SQL tables to Redis via CLI and Go Module
- [x] Support for most commonly used Redis data types (strings, lists, hashes)
- [X] Support for Postgres and MySQL
- [x] Advanced logging with levels and optional file output
- [ ] Autosync
- [ ] Dockerization