LCOV - code coverage report
Current view: top level - domain/entity - relationship_type.go Coverage Total Hit
Test: coverage.lcov Lines: 0.0 % 1 0
Test Date: 2026-04-14 06:42:22 Functions: - 0 0

            Line data    Source code
       1              : // Package entity は 続柄 を表すドメインエンティティです
       2              : package entity
       3              : 
       4              : import "time"
       5              : 
       6              : // RelationshipType は 続柄 を表すドメインエンティティです
       7              : type RelationshipType struct {
       8              :         ID        uint64    `gorm:"primaryKey;autoIncrement;column:id"`
       9              :         Code      string    `gorm:"size:64;not null;unique;column:code"`
      10              :         SortOrder int       `gorm:"not null;default:0;column:sort_order"`
      11              :         IsActive  bool      `gorm:"not null;default:true;column:is_active"`
      12              :         CreatedAt time.Time `gorm:"autoCreateTime;column:created_at"`
      13              :         UpdatedAt time.Time `gorm:"autoUpdateTime;column:updated_at"`
      14              : }
      15              : 
      16              : // TableName は GORM用のテーブル名を返します
      17            0 : func (RelationshipType) TableName() string { return "relationship_types" }
      18              : 
      19              : // RelationshipTypeID は 続柄IDを表す定数です
      20              : const (
      21              :         RelationshipTypeSelfID           uint64 = 1
      22              :         RelationshipTypeHusbandID        uint64 = 2
      23              :         RelationshipTypeWifeID           uint64 = 3
      24              :         RelationshipTypeSonID            uint64 = 4
      25              :         RelationshipTypeDaughterID       uint64 = 5
      26              :         RelationshipTypeFatherID         uint64 = 6
      27              :         RelationshipTypeMotherID         uint64 = 7
      28              :         RelationshipTypeFatherInLawID    uint64 = 8
      29              :         RelationshipTypeMotherInLawID    uint64 = 9
      30              :         RelationshipTypeStepFatherID     uint64 = 10
      31              :         RelationshipTypeStepMotherID     uint64 = 11
      32              :         RelationshipTypeAdoptiveFatherID uint64 = 12
      33              :         RelationshipTypeAdoptiveMotherID uint64 = 13
      34              : )
      35              : 
      36              : // RelationshipTypeCode は 続柄コードを表す定数です
      37              : const (
      38              :         RelationshipTypeSelfCode           string = "self"
      39              :         RelationshipTypeHusbandCode        string = "spouse_husband"
      40              :         RelationshipTypeWifeCode           string = "spouse_wife"
      41              :         RelationshipTypeSonCode            string = "child_son"
      42              :         RelationshipTypeDaughterCode       string = "child_daughter"
      43              :         RelationshipTypeFatherCode         string = "father"
      44              :         RelationshipTypeMotherCode         string = "mother"
      45              :         RelationshipTypeFatherInLawCode    string = "father_in_law"
      46              :         RelationshipTypeMotherInLawCode    string = "mother_in_law"
      47              :         RelationshipTypeStepFatherCode     string = "step_father"
      48              :         RelationshipTypeStepMotherCode     string = "step_mother"
      49              :         RelationshipTypeAdoptiveFatherCode string = "adoptive_father"
      50              :         RelationshipTypeAdoptiveMotherCode string = "adoptive_mother"
      51              : )
      52              : 
      53              : // 以下は トランザクション側の エンティティができてから再設計とする
      54              : //// IsFamily は 家族であること(本人でないこと)を確認する
      55              : //func (r RelationshipType) IsFamily() bool {
      56              : //      return r.ID != RelationshipTypeSelfID
      57              : //}
      58              : //
      59              : //// IsSpouse は 配偶者であること(夫または妻)を確認する
      60              : //func (r RelationshipType) IsSpouse() bool {
      61              : //      return r.ID == RelationshipTypeHusbandID || r.ID == RelationshipTypeWifeID
      62              : //}
      63              : //
      64              : //// IsChild は 子供であること(息子または娘)を確認する
      65              : //func (r RelationshipType) IsChild() bool {
      66              : //      return r.ID == RelationshipTypeSonID || r.ID == RelationshipTypeDaughterID
      67              : //}
      68              : //
      69              : //// IsParent は 親であること(父母 + 義父母)を確認する
      70              : //func (r RelationshipType) IsParent() bool {
      71              : //      //return r.IsFamily() && !r.IsSpouse() && !r.IsChild()
      72              : //      return r.ID == RelationshipTypeFatherID ||
      73              : //              r.ID == RelationshipTypeMotherID ||
      74              : //              r.ID == RelationshipTypeFatherInLawID ||
      75              : //              r.ID == RelationshipTypeMotherInLawID
      76              : //}
        

Generated by: LCOV version 2.3.1-1