|
- package main
-
- import "time"
-
- type crmdEntityBase struct {
- AssignedUserID string `json:"assignedUserId,omitempty"`
- AssignedUserName string `json:"assignedUsername,omitempty"`
- CreatedAt string `json:"createdAt,omitempty"`
- CreatedByID string `json:"createdById,omitempty"`
- CreatedByName string `json:"createdByName,omitempty"`
- Deleted bool `json:"deleted,omitempty"`
- Description string `json:"description"`
- ID string `json:"id,omitempty"`
- ModifiedAt string `json:"modifiedAt,omitempty"`
- ModifiedByID string `json:"modifiedById,omitempty"`
- ModifiedByName string `json:"modifiedByName,omitempty"`
- Name string `json:"name,omitEmpty"`
- TeamsIDs []string `json:"teamsIds,omitempty"`
- TeamsNames map[string]string `json:"teamsNames,omitEmpty"`
- }
-
- func (m crmdEntityBase) getCreatedAt() (r time.Time) {
- layout := m.getTimeLayout()
- r, _ = time.Parse(layout, m.CreatedAt)
- return
- }
-
- func (m *crmdEntityBase) setCreatedAt(v time.Time) string {
- layout := m.getTimeLayout()
- m.CreatedAt = v.Format(layout)
- return m.CreatedAt
- }
-
- func (m crmdEntityBase) getModifiedAt() (r time.Time) {
- layout := m.getTimeLayout()
- r, _ = time.Parse(layout, m.ModifiedAt)
- return
- }
-
- func (m *crmdEntityBase) setModifiedAt(v time.Time) string {
- layout := m.getTimeLayout()
- m.ModifiedAt = v.Format(layout)
- return m.ModifiedAt
- }
-
- func (m *crmdEntityBase) getTimeLayout() string {
- return getCrmTimeLayout()
- }
-
- func getCrmTimeLayout() string {
- return "2006-01-02 15:04:05"
- }
|