mirror of
https://github.com/emo2007/block-accounting.git
synced 2025-04-12 08:56:28 +00:00
21 lines
318 B
Go
21 lines
318 B
Go
package domain
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
)
|
|
|
|
type JoinResponse struct {
|
|
Mnemonic string `json:"mnemonic"`
|
|
}
|
|
|
|
func BuildRequest[T any](data []byte) (*T, error) {
|
|
var req T
|
|
|
|
if err := json.Unmarshal(data, &req); err != nil {
|
|
return nil, fmt.Errorf("error unmarshal request. %w", err)
|
|
}
|
|
|
|
return &req, nil
|
|
}
|