(s *schema.Schema, tableName string, q sq.SelectBuilder)
| 804 | } |
| 805 | |
| 806 | func makeJoin(s *schema.Schema, tableName string, q sq.SelectBuilder) sq.SelectBuilder { |
| 807 | manager := schema.GetManager() |
| 808 | for _, property := range s.Properties { |
| 809 | if property.RelationProperty == "" { |
| 810 | continue |
| 811 | } |
| 812 | relatedSchema, _ := manager.Schema(property.Relation) |
| 813 | aliasTableName := makeAliasTableName(tableName, property) |
| 814 | q = q.LeftJoin( |
| 815 | fmt.Sprintf("%s as %s on %s.%s = %s.id", quote(relatedSchema.GetDbTableName()), quote(aliasTableName), |
| 816 | quote(tableName), quote(property.ID), quote(aliasTableName))) |
| 817 | q = makeJoin(relatedSchema, aliasTableName, q) |
| 818 | } |
| 819 | return q |
| 820 | } |
| 821 | |
| 822 | func decodeState(data map[string]interface{}, state *transaction.ResourceState) error { |
| 823 | var ok bool |
no test coverage detected