소스 검색

Add csv tags in Credential

Andrea Fazzi 6 년 전
부모
커밋
23531da040
1개의 변경된 파일9개의 추가작업 그리고 5개의 파일을 삭제
  1. 9 5
      orm/credential.go

+ 9 - 5
orm/credential.go

@@ -13,14 +13,14 @@ import (
 type Checkbox bool
 
 type Credential struct {
-	Name            string
-	Surname         string
+	Name            string `csv:"firstname"`
+	Surname         string `csv:"lastname"`
 	Password        string
 	PlainPassword   string
-	Email           string
+	Email           string `csv:"email"`
 	AltEmail        string
-	FromDate        time.Time
-	ToDate          time.Time
+	DateFrom        time.Time
+	DateTo          time.Time
 	TelephoneNumber string
 
 	Regenerate bool `schema:"Regenerate" sql:"default: false"`
@@ -54,3 +54,7 @@ func (c *Credential) GeneratePassword() (string, error) {
 func (c *Credential) CompleteName() string {
 	return fmt.Sprintf("%s, %s", c.Name, c.Surname)
 }
+
+func (c *Credential) MailAddress(domain string) string {
+	return fmt.Sprintf("%s@%s", c.Username(), domain)
+}