github.com/10ego/gthp@v0.0.0-20241025155251-e1514fa71fbb/internal/database/entities/models.go (about) 1 // Code generated by sqlc. DO NOT EDIT. 2 // versions: 3 // sqlc v1.27.0 4 5 package db 6 7 import ( 8 "database/sql" 9 "database/sql/driver" 10 "fmt" 11 ) 12 13 type OrgType string 14 15 const ( 16 OrgTypeDivision OrgType = "Division" 17 OrgTypeBureau OrgType = "Bureau" 18 OrgTypeDirectorate OrgType = "Directorate" 19 OrgTypeBranch OrgType = "Branch" 20 ) 21 22 func (e *OrgType) Scan(src interface{}) error { 23 switch s := src.(type) { 24 case []byte: 25 *e = OrgType(s) 26 case string: 27 *e = OrgType(s) 28 default: 29 return fmt.Errorf("unsupported scan type for OrgType: %T", src) 30 } 31 return nil 32 } 33 34 type NullOrgType struct { 35 OrgType OrgType 36 Valid bool // Valid is true if OrgType is not NULL 37 } 38 39 // Scan implements the Scanner interface. 40 func (ns *NullOrgType) Scan(value interface{}) error { 41 if value == nil { 42 ns.OrgType, ns.Valid = "", false 43 return nil 44 } 45 ns.Valid = true 46 return ns.OrgType.Scan(value) 47 } 48 49 // Value implements the driver Valuer interface. 50 func (ns NullOrgType) Value() (driver.Value, error) { 51 if !ns.Valid { 52 return nil, nil 53 } 54 return string(ns.OrgType), nil 55 } 56 57 type StaffStatus string 58 59 const ( 60 StaffStatusActive StaffStatus = "Active" 61 StaffStatusOnAssignment StaffStatus = "On Assignment" 62 StaffStatusLeaveofAbsence StaffStatus = "Leave of Absence" 63 StaffStatusInactive StaffStatus = "Inactive" 64 ) 65 66 func (e *StaffStatus) Scan(src interface{}) error { 67 switch s := src.(type) { 68 case []byte: 69 *e = StaffStatus(s) 70 case string: 71 *e = StaffStatus(s) 72 default: 73 return fmt.Errorf("unsupported scan type for StaffStatus: %T", src) 74 } 75 return nil 76 } 77 78 type NullStaffStatus struct { 79 StaffStatus StaffStatus 80 Valid bool // Valid is true if StaffStatus is not NULL 81 } 82 83 // Scan implements the Scanner interface. 84 func (ns *NullStaffStatus) Scan(value interface{}) error { 85 if value == nil { 86 ns.StaffStatus, ns.Valid = "", false 87 return nil 88 } 89 ns.Valid = true 90 return ns.StaffStatus.Scan(value) 91 } 92 93 // Value implements the driver Valuer interface. 94 func (ns NullStaffStatus) Value() (driver.Value, error) { 95 if !ns.Valid { 96 return nil, nil 97 } 98 return string(ns.StaffStatus), nil 99 } 100 101 type Organization struct { 102 ID string 103 Name string 104 Type OrgType 105 ParentID sql.NullString 106 } 107 108 type User struct { 109 ID string 110 Uid string 111 Name string 112 JobTitle string 113 Office string 114 Organizations string 115 Status StaffStatus 116 Telephone sql.NullString 117 }