mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-26 04:07:50 +00:00
1 line
5.7 KiB
JSON
1 line
5.7 KiB
JSON
{"primaryContentSections":[{"kind":"declarations","declarations":[{"tokens":[{"kind":"keyword","text":"func"},{"kind":"text","text":" "},{"kind":"identifier","text":"having"},{"kind":"text","text":"("},{"kind":"externalParam","text":"_"},{"kind":"text","text":" "},{"kind":"internalParam","text":"predicate"},{"kind":"text","text":": "},{"kind":"typeIdentifier","identifier":"doc:\/\/GRDB\/documentation\/GRDB\/AssociationAggregate","preciseIdentifier":"s:4GRDB20AssociationAggregateV","text":"AssociationAggregate"},{"kind":"text","text":"<"},{"kind":"typeIdentifier","text":"Self"},{"kind":"text","text":"."},{"kind":"typeIdentifier","text":"RowDecoder"},{"kind":"text","text":">) -> "},{"kind":"typeIdentifier","text":"Self"}],"languages":["swift"],"platforms":["macOS"]}]},{"kind":"content","content":[{"anchor":"discussion","level":2,"type":"heading","text":"Discussion"},{"type":"paragraph","inlineContent":[{"type":"text","text":"For example:"}]},{"type":"codeListing","syntax":"swift","code":["struct Author: TableRecord, FetchableRecord {"," static let books = hasMany(Book.self)","}","struct Book: TableRecord, FetchableRecord { }","","\/\/ SELECT author.*","\/\/ FROM author","\/\/ LEFT JOIN book ON book.authorId = author.id","\/\/ GROUP BY author.id","\/\/ HAVING COUNT(DISTINCT book.id) > 5","let authors = try Author.all()"," .having(Author.books.count > 5)"," .fetchAll(db)"]}]}],"schemaVersion":{"major":0,"minor":3,"patch":0},"sections":[],"variants":[{"paths":["\/documentation\/grdb\/queryinterfacerequest\/having(_:)"],"traits":[{"interfaceLanguage":"swift"}]}],"identifier":{"url":"doc:\/\/GRDB\/documentation\/GRDB\/QueryInterfaceRequest\/having(_:)","interfaceLanguage":"swift"},"abstract":[{"type":"text","text":"Filters the fetched records with an association aggregate."}],"kind":"symbol","metadata":{"role":"symbol","title":"having(_:)","roleHeading":"Instance Method","fragments":[{"kind":"keyword","text":"func"},{"kind":"text","text":" "},{"kind":"identifier","text":"having"},{"kind":"text","text":"("},{"kind":"typeIdentifier","text":"AssociationAggregate","preciseIdentifier":"s:4GRDB20AssociationAggregateV"},{"kind":"text","text":"<"},{"kind":"typeIdentifier","text":"Self"},{"kind":"text","text":"."},{"kind":"typeIdentifier","text":"RowDecoder"},{"kind":"text","text":">) -> "},{"kind":"typeIdentifier","text":"Self"}],"symbolKind":"method","externalID":"s:4GRDB16DerivableRequestPAAE6havingyxAA20AssociationAggregateVy10RowDecoderQzGF::SYNTHESIZED::s:4GRDB21QueryInterfaceRequestV","extendedModule":"GRDB","modules":[{"name":"GRDB"}]},"hierarchy":{"paths":[["doc:\/\/GRDB\/documentation\/GRDB","doc:\/\/GRDB\/documentation\/GRDB\/QueryInterface","doc:\/\/GRDB\/documentation\/GRDB\/QueryInterfaceRequest","doc:\/\/GRDB\/documentation\/GRDB\/QueryInterfaceRequest\/DerivableRequest-Implementations"]]},"references":{"doc://GRDB/documentation/GRDB/QueryInterface":{"role":"collectionGroup","title":"Record Types and the Query Interface","abstract":[{"type":"text","text":"Record types and the query interface build SQL queries for you"}],"identifier":"doc:\/\/GRDB\/documentation\/GRDB\/QueryInterface","kind":"article","type":"topic","url":"\/documentation\/grdb\/queryinterface"},"doc://GRDB/documentation/GRDB/AssociationAggregate":{"role":"symbol","title":"AssociationAggregate","fragments":[{"kind":"keyword","text":"struct"},{"kind":"text","text":" "},{"kind":"identifier","text":"AssociationAggregate"}],"abstract":[{"type":"text","text":"A value aggregated from a population of associated records."}],"identifier":"doc:\/\/GRDB\/documentation\/GRDB\/AssociationAggregate","kind":"symbol","type":"topic","navigatorTitle":[{"kind":"identifier","text":"AssociationAggregate"}],"url":"\/documentation\/grdb\/associationaggregate"},"doc://GRDB/documentation/GRDB/QueryInterfaceRequest":{"role":"symbol","title":"QueryInterfaceRequest","fragments":[{"kind":"keyword","text":"struct"},{"kind":"text","text":" "},{"kind":"identifier","text":"QueryInterfaceRequest"}],"abstract":[{"type":"text","text":"A request that builds SQL queries with Swift."}],"identifier":"doc:\/\/GRDB\/documentation\/GRDB\/QueryInterfaceRequest","kind":"symbol","type":"topic","navigatorTitle":[{"kind":"identifier","text":"QueryInterfaceRequest"}],"url":"\/documentation\/grdb\/queryinterfacerequest"},"doc://GRDB/documentation/GRDB/QueryInterfaceRequest/having(_:)":{"role":"symbol","title":"having(_:)","fragments":[{"kind":"keyword","text":"func"},{"kind":"text","text":" "},{"kind":"identifier","text":"having"},{"kind":"text","text":"("},{"kind":"typeIdentifier","text":"AssociationAggregate","preciseIdentifier":"s:4GRDB20AssociationAggregateV"},{"kind":"text","text":"<"},{"kind":"typeIdentifier","text":"Self"},{"kind":"text","text":"."},{"kind":"typeIdentifier","text":"RowDecoder"},{"kind":"text","text":">) -> "},{"kind":"typeIdentifier","text":"Self"}],"abstract":[{"type":"text","text":"Filters the fetched records with an association aggregate."}],"identifier":"doc:\/\/GRDB\/documentation\/GRDB\/QueryInterfaceRequest\/having(_:)","kind":"symbol","type":"topic","url":"\/documentation\/grdb\/queryinterfacerequest\/having(_:)"},"doc://GRDB/documentation/GRDB":{"role":"collection","title":"GRDB","abstract":[{"type":"text","text":"A toolkit for SQLite databases, with a focus on application development"}],"identifier":"doc:\/\/GRDB\/documentation\/GRDB","kind":"symbol","type":"topic","url":"\/documentation\/grdb"},"doc://GRDB/documentation/GRDB/QueryInterfaceRequest/DerivableRequest-Implementations":{"role":"collectionGroup","title":"DerivableRequest Implementations","abstract":[],"identifier":"doc:\/\/GRDB\/documentation\/GRDB\/QueryInterfaceRequest\/DerivableRequest-Implementations","kind":"article","type":"topic","url":"\/documentation\/grdb\/queryinterfacerequest\/derivablerequest-implementations"}}} |