(persona string)
| 214 | } |
| 215 | |
| 216 | func ProofChainFindLatest(persona string) (pc *ProofChain, err error) { |
| 217 | pc = new(ProofChain) |
| 218 | tx := ReadOnlyDB.Where("persona = ?", MarshalPersona(persona)).Order("id DESC").Take(pc) |
| 219 | if tx.Error != nil { |
| 220 | if strings.Contains(tx.Error.Error(), "record not found") { |
| 221 | return nil, nil |
| 222 | } |
| 223 | return nil, xerrors.Errorf("%w", tx.Error) |
| 224 | } |
| 225 | |
| 226 | return pc, nil |
| 227 | } |
| 228 | |
| 229 | func ProofChainFindBySignature(signature string) (pc *ProofChain, err error) { |
| 230 | previous := &ProofChain{} |