📄️ Model Query - Where
A detailed discussion of the various conditional query methods provided by the ORM component in the GoFrame framework, including ways to use methods like Where, WhereOr, Wheref, etc., and how they perform conditional grouping. Through examples, it demonstrates how to use these methods for complex database queries and explores the advantages of using primary key queries.
📄️ Model Query - Methods
Five common data query methods in the GoFrame framework: All, One, Array, Value, and Count. These methods allow you to easily retrieve multiple or single records from the database and support direct input of conditional parameters. Through example code, you'll learn how to efficiently perform database operations in GoFrame.
📄️ Model Query - AllAndCount
This document introduces the AllAndCount method provided in the GoFrame framework from version v2.5.0, which is used to simultaneously retrieve data record lists and total counts in paging query scenarios, simplifying query logic. By ignoring Limit/Page operations during queries, the AllAndCount method provides a convenient way to retrieve and count data.
📄️ Model Query - Exist
Using the Exist method in the GoFrame framework can effectively determine whether data meeting specific conditions exists without needing to retrieve the complete data result. Combined with MySQL table structures, it improves query efficiency using the SELECT 1 method, reducing unnecessary data transmission. This article includes method definition, MySQL table structure examples, and practical use cases to help developers better optimize model query processes.
📄️ Model Query - Scan
Techniques for using the Scan method for ORM queries in the GoFrame framework, mainly including how to convert query results to struct objects and struct arrays. Illustrated with example code demonstrating the usage of the Scan method, such as converting a single record to a struct object and multiple records to a struct array, helping users effectively handle database query results.
📄️ Model Query - ScanAndCount
When using the GoFrame framework for ORM queries, simplify pagination query scenarios. With the ScanAndCount method, data queries and total count queries can be completed in a single operation, effectively reducing code redundancy and improving development efficiency. Suitable for situations where both data and its total count need to be obtained, such as pagination queries.
📄️ Model Query - Join
How to use ORM for LeftJoin, RightJoin, and InnerJoin queries in the GoFrame framework, including different associated query methods and their application scenarios. The article emphasizes caution in using Join operations in scenarios with large data volume and high concurrency, recommending code-based data aggregation. It also provides examples of join queries using custom table aliases and field operators, along with specific usage methods combined with dao.
📄️ Model Query - Group/Order
Use GoFrame framework's ORM for query operations including grouping, sorting, and condition filtering. Implement data grouping with the Group method, sorting with the Order method, and condition filtering on query results with the Having method. Provides detailed code examples and method explanations to help users better master database operation skills.
📄️ Model Query - Union/UnionAll
Use the ORM component in the GoFrame framework to perform Union and UnionAll query operations. The Union operator can remove duplicate data, while the UnionAll operator retains all data. These two query methods can be easily achieved through chaining operations or method operations. The article also introduces how to perform combined queries in MySQL and provides detailed code examples.
📄️ Model Query - Subquery
Three subquery features supported by the ORM component in the GoFrame framework: Where subquery, Having subquery, and From subquery. Examples demonstrate how to use subqueries in Where, Having conditions, and when using the Model method to create models to enhance database query efficiency.
📄️ Model Query - Operators
Common operation examples for ORM queries using the GoFrame framework, including IN, LIKE, MIN/MAX/AVG/SUM operations. It also introduces the use of chaining query methods like WhereIn, WhereNotIn, WhereBetween, etc., and helps understand different query strategies and parameter filtering through examples.