| 1 | package Google::Spanner::V1::Type::Types; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | use Type::Library -base; | ||
| 7 | use Type::Utils -all; | ||
| 8 | use Types::Standard -types; | ||
| 9 | |||
| 10 | declare 'TypeCode', | ||
| 11 | as (Int | Str); | ||
| 12 | |||
| 13 | declare 'TypeAnnotationCode', | ||
| 14 | as (Int | Str); | ||
| 15 | |||
| 16 | declare 'Type', | ||
| 17 | as InstanceOf['Google::Spanner::V1::Type::Type']; | ||
| 18 | |||
| 19 | coerce 'Type', | ||
| 20 | from HashRef, via { 'Google::Spanner::V1::Type::Type'->new($_) }; | ||
| 21 | |||
| 22 | declare 'RepeatedType', | ||
| 23 | as ArrayRef[Type()]; | ||
| 24 | |||
| 25 | coerce 'RepeatedType', | ||
| 26 | from ArrayRef[HashRef], via { [ map { 'Google::Spanner::V1::Type::Type'->new($_) } @$_ ] }; | ||
| 27 | |||
| 28 | declare 'MapStringType', | ||
| 29 | as HashRef[Type()]; | ||
| 30 | |||
| 31 | declare 'StructType', | ||
| 32 | as InstanceOf['Google::Spanner::V1::Type::StructType']; | ||
| 33 | |||
| 34 | coerce 'StructType', | ||
| 35 | from HashRef, via { 'Google::Spanner::V1::Type::StructType'->new($_) }; | ||
| 36 | |||
| 37 | declare 'RepeatedStructType', | ||
| 38 | as ArrayRef[StructType()]; | ||
| 39 | |||
| 40 | coerce 'RepeatedStructType', | ||
| 41 | from ArrayRef[HashRef], via { [ map { 'Google::Spanner::V1::Type::StructType'->new($_) } @$_ ] }; | ||
| 42 | |||
| 43 | declare 'MapStringStructType', | ||
| 44 | as HashRef[StructType()]; | ||
| 45 | |||
| 46 | declare 'Field', | ||
| 47 | as InstanceOf['Google::Spanner::V1::Type::StructType::Field']; | ||
| 48 | |||
| 49 | coerce 'Field', | ||
| 50 | from HashRef, via { 'Google::Spanner::V1::Type::StructType::Field'->new($_) }; | ||
| 51 | |||
| 52 | declare 'RepeatedField', | ||
| 53 | as ArrayRef[Field()]; | ||
| 54 | |||
| 55 | coerce 'RepeatedField', | ||
| 56 | from ArrayRef[HashRef], via { [ map { 'Google::Spanner::V1::Type::StructType::Field'->new($_) } @$_ ] }; | ||
| 57 | |||
| 58 | declare 'MapStringField', | ||
| 59 | as HashRef[Field()]; | ||
| 60 | |||
| 61 | 1; | ||
| 62 | |||
| 63 | __END__ |