forked from switchupcb/copygen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
copygen.go
35 lines (29 loc) · 823 Bytes
/
copygen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Code generated by github.com/reedom/copygen
// DO NOT EDIT.
// Package copygen contains the setup information for copygen generated code.
package copygen
import (
"fmt"
c "strconv"
"github.com/reedom/copygen/examples/error/domain"
"github.com/reedom/copygen/examples/error/models"
)
/* The paring converter function can return an error value. */
// Itoa converts an integer to an ascii value.
func Itoa(i int) (string, error) {
if i < 1 {
return "", fmt.Errorf("invalid id")
}
return c.Itoa(i), nil
}
// ModelsToDomain copies a *models.Account, *models.User to a *domain.Account.
func ModelsToDomain(tA *domain.Account, fA *models.Account, fU *models.User) (err error) {
// *domain.Account fields
tA.ID = fA.ID
tA.UserID, err = Itoa(fU.UserID)
if err != nil {
return
}
tA.Name = fA.Name
return
}