mirror of
https://github.com/harness/drone.git
synced 2025-05-07 03:19:14 +08:00
16 lines
317 B
Go
16 lines
317 B
Go
package database
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
sqlx "github.com/jmoiron/sqlx/types"
|
|
)
|
|
|
|
// EncodeToJSON accepts a generic parameter and returns
|
|
// a sqlx.JSONText object which is used to store arbitrary
|
|
// data in the DB.
|
|
func EncodeToJSON(v any) sqlx.JSONText {
|
|
raw, _ := json.Marshal(v)
|
|
return sqlx.JSONText(raw)
|
|
}
|