getIdentityIdentifier generates a unique identifier string for an identity. It uses the identity's name (first/last or organization) combined with a portion of the ID. Parameters: - identity *model.Identity: The identity to generate an identifier for. Returns: - string: The generated identifier.
(identity *model.Identity)
| 805 | // Returns: |
| 806 | // - string: The generated identifier. |
| 807 | func (l *LedgerForge) getIdentityIdentifier(identity *model.Identity) string { |
| 808 | var namePart string |
| 809 | |
| 810 | if identity.FirstName != "" && identity.LastName != "" { |
| 811 | namePart = strings.ToLower(fmt.Sprintf("%s_%s", identity.FirstName, identity.LastName)) |
| 812 | } else if identity.OrganizationName != "" { |
| 813 | namePart = strings.ToLower(strings.ReplaceAll(identity.OrganizationName, " ", "_")) |
| 814 | } else { |
| 815 | // No name available, use full ID |
| 816 | return identity.IdentityID |
| 817 | } |
| 818 | |
| 819 | // Use first 8 characters of ID for uniqueness |
| 820 | idPart := identity.IdentityID |
| 821 | if len(idPart) > 8 { |
| 822 | idPart = idPart[:8] |
| 823 | } |
| 824 | |
| 825 | return fmt.Sprintf("%s_%s", namePart, idPart) |
| 826 | } |
| 827 | |
| 828 | // getLineageSources retrieves the available fund sources from shadow balances for allocation. |
| 829 | // Uses a single batch query to fetch all shadow balances instead of N individual queries. |
no outgoing calls