1 /* 2 * Copyright 2015-2018 HuntLabs.cn. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 module hunt.sql.builder.SQLBuilder; 18 19 import hunt.sql.SQLUtils; 20 21 interface SQLBuilder { 22 23 SQLBuilder select(string[] column...); 24 25 SQLBuilder selectWithAlias(string column, string _alias); 26 27 SQLBuilder from(string table); 28 29 SQLBuilder from(string table, string _alias); 30 31 SQLBuilder orderBy(string[] columns...); 32 33 SQLBuilder groupBy(string expr); 34 35 SQLBuilder having(string expr); 36 37 SQLBuilder into(string expr); 38 39 SQLBuilder limit(int rowCount); 40 41 SQLBuilder offset(int offset); 42 43 SQLBuilder limit(int rowCount, int offset); 44 45 SQLBuilder where(string sql); 46 47 SQLBuilder whereAnd(string sql); 48 49 SQLBuilder whereOr(string sql); 50 51 SQLBuilder join(string table , string _alias = null, string cond = null); 52 53 SQLBuilder innerJoin(string table , string _alias = null, string cond = null); 54 55 SQLBuilder leftJoin(string table , string _alias = null, string cond = null); 56 57 SQLBuilder rightJoin(string table , string _alias = null, string cond = null); 58 59 string toString(); 60 61 string toString(FormatOption option); 62 }