Created
October 13, 2021 18:06
-
-
Save immannino/b5e9d86ad69a63a439e8a7f68752c752 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package model | |
import ( | |
"fmt" | |
"strings" | |
"time" | |
) | |
type PDF struct { | |
FirstName string `json:"FirstName" example:"Tony"` | |
LastName string `json:"LastName" example:"Mannino"` | |
CompanyName string `json:"CompanyName" example:"ShareBuilder 401k"` | |
PhoneNumber string `json:"PhoneNumber" example:"+1 (800) 123-4567"` | |
AssetsDir string | |
FullName string | |
CompanySignature string | |
} | |
func NewPDFModel(workingDir string) *PDF { | |
return &PDF{ | |
AssetsDir: strings.Join([]string{workingDir, "/static"}, ""), | |
} | |
} | |
// Process some extra fields for our PDF Template | |
func (p *PDF) FillMissing() { | |
p.FullName = strings.Join([]string{p.FirstName, p.LastName}, " ") | |
p.CompanySignature = fmt.Sprintf("%s - %s - %v", p.CompanyName, p.PhoneNumber, time.Now().Year()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment