Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

207
Views
Uso de Uint8Array como argumento para la mutación en typegraphql

Necesito guardar una clave pública en mi base de datos postgres de graphql. Usar un Uint8Array parece la mejor opción para guardar esto (avíseme si tiene una mejor sugerencia). Por lo tanto tengo la entidad:

 @ObjectType() @Entity() export class Wallet extends BaseEntity { @Field() @PrimaryGeneratedColumn() id!: number; @Field() @Column({ type: 'bytea' }) public_key!: Uint8Array; }

Y el resolutor:

 @Mutation(() => User) async createUser( @Arg("email") email: string, @Arg("wallets", _type => [Uint8Array], { nullable: true }) wallets: Uint8Array[], @Ctx() { em }: MyContext ): Promise<User> { // input validation const user = { email: email, wallets: (wallets ? wallets.map(e => ({ 'public_key': e })) : []) } return { user: await em.save(User, user) }; }

CannotDetermineGraphQLTypeError: Cannot determine GraphQL input type for argument named 'wallets' of 'createUser' of 'UserResolver' class. Is the value, that is used as its TS type or explicit type, decorated with a proper decorator or is it a proper input value?

No estoy seguro de entender este error correctamente, ¿no puedo usar Uint8Array como entrada para mi mutación o lo estoy haciendo incorrectamente?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

GraphQL no admite tipos binarios listos para usar. Se recomienda usar cadenas codificadas en Base-64 en su lugar, lo que funciona bien para cargas útiles pequeñas. Leer más: Binario en GraphQL

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!