You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
580 B

  1. package config
  2. // UserConfig holds configuration fields related to a user account.
  3. //
  4. type UserConfig struct {
  5. As string `json:"as" validate:"omitempty,username"` // user name
  6. UID uint `json:"uid"` // user ID
  7. GID uint `json:"gid"` // group ID
  8. }
  9. // Merge takes another UserConfig and overwrites this struct's fields.
  10. //
  11. func (user *UserConfig) Merge(user2 UserConfig) {
  12. if user2.As != "" {
  13. user.As = user2.As
  14. }
  15. if user2.UID != 0 {
  16. user.UID = user2.UID
  17. }
  18. if user2.GID != 0 {
  19. user.GID = user2.GID
  20. }
  21. }