Operators​

This section describes introspection of EdgeDB operators. Much like functions, operators have parameters and return types as well as a few other features.

Introspection of the schema::Operator:

  1. with module schema
  2. select ObjectType {
  3. name,
  4. links: {
  5. name,
  6. },
  7. properties: {
  8. name,
  9. }
  10. }
  11. filter .name = 'schema::Operator';
  1. {
  2. Object {
  3. name: 'schema::Operator',
  4. links: {
  5. Object { name: '__type__' },
  6. Object { name: 'annotations' },
  7. Object { name: 'params' },
  8. Object { name: 'return_type' }
  9. },
  10. properties: {
  11. Object { name: 'id' },
  12. Object { name: 'name' },
  13. Object { name: 'operator_kind' },
  14. Object { name: 'return_typemod' }
  15. }
  16. }
  17. }

Since params are quite important to operators, here’s their structure:

  1. with module schema
  2. select ObjectType {
  3. name,
  4. links: {
  5. name,
  6. },
  7. properties: {
  8. name,
  9. }
  10. }
  11. filter .name = 'schema::Parameter';
  1. {
  2. Object {
  3. name: 'schema::Parameter',
  4. links: {
  5. Object { name: '__type__' },
  6. Object { name: 'type' }
  7. },
  8. properties: {
  9. Object { name: 'default' },
  10. Object { name: 'id' },
  11. Object { name: 'kind' },
  12. Object { name: 'name' },
  13. Object { name: 'num' },
  14. Object { name: 'typemod' }
  15. }
  16. }
  17. }

Introspection of the and operator:

  1. with module schema
  2. select Operator {
  3. name,
  4. operator_kind,
  5. annotations: { name, @value },
  6. params: {
  7. kind,
  8. name,
  9. num,
  10. typemod,
  11. type: { name },
  12. default,
  13. },
  14. return_typemod,
  15. return_type: { name },
  16. }
  17. filter .name = 'std::AND';
  1. {
  2. Object {
  3. name: 'std::AND',
  4. operator_kind: 'Infix',
  5. annotations: {},
  6. params: {
  7. Object {
  8. kind: 'PositionalParam',
  9. name: 'a',
  10. num: 0,
  11. typemod: 'SingletonType',
  12. type: Object { name: 'std::bool' },
  13. default: {}
  14. },
  15. Object {
  16. kind: 'PositionalParam',
  17. name: 'b',
  18. num: 1,
  19. typemod: 'SingletonType',
  20. type: Object { name: 'std::bool' },
  21. default: {}
  22. }
  23. },
  24. return_typemod: 'SingletonType',
  25. return_type: Object { name: 'std::bool' }
  26. }
  27. }