# juice
**Repository Path**: eatmoreapple/juice
## Basic Information
- **Project Name**: juice
- **Description**: SQL mapper framework for Golang
- **Primary Language**: Go
- **License**: Apache-2.0
- **Default Branch**: main
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 2
- **Forks**: 0
- **Created**: 2022-11-06
- **Last Updated**: 2025-12-30
## Categories & Tags
**Categories**: database-dev
**Tags**: None
## README
## Juice SQL Mapper Framework For Golang
[](https://godoc.org/github.com/go-juicedev/juice)
[](https://github.com/go-juicedev/juice/releases)


[](https://plugins.jetbrains.com/plugin/26401-juice)
[](https://plugins.jetbrains.com/plugin/26401-juice)
Juice is a SQL mapper framework for Golang, inspired by MyBatis. It is simple, lightweight, and easy to use and extend.
This document provides a brief introduction to Juice and its usage.
- [Installation](#installation)
- [Example](#example)
- [API Documentation](#api-documentation)
- [License](#license)
- [Support Me](#support-me)
### Installation
To install Juice, use the following command:
```shell
go get github.com/go-juicedev/juice
```
### Example
```shell
touch config.xml
```
add the following content to config.xml
```xml
sqlite.dbsqlite3
```
```shell
touch mappers.xml
```
add the following content to mappers.xml
```xml
```
```shell
touch main.go
```
add the following content to main.go
```go
package main
import (
"context"
"fmt"
"github.com/go-juicedev/juice"
_ "github.com/mattn/go-sqlite3"
)
type Repository interface {
HelloWorld(ctx context.Context) (string, error)
}
type RepositoryImpl struct {
manager juice.Manager
}
func (r RepositoryImpl) HelloWorld(ctx context.Context) (string, error) {
executor := juice.NewGenericManager[string](r.manager).Object(Repository(r).HelloWorld)
return executor.QueryContext(ctx, nil)
}
func main() {
cfg, err := juice.NewXMLConfiguration("config.xml")
if err != nil {
panic(err)
}
engine, err := juice.Default(cfg)
if err != nil {
panic(err)
}
defer engine.Close()
repo := RepositoryImpl{manager: engine}
result, err := repo.HelloWorld(context.TODO())
fmt.Println(result, err) // hello world
}
```
```shell
CGO_ENABLED=1 go run main.go
```
### API Documentation
[English](https://juice-doc.readthedocs.io/projects/juice-doc-en/en/latest/)
[简体中文](https://juice-doc.readthedocs.io/en/latest/index.html)
### License
Juice is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.
## Support Me
If you like my work, please consider supporting me by buying me a coffee.