WriteLimit writes the limit
(n int)
| 236 | |
| 237 | // WriteLimit writes the limit |
| 238 | func (b *SQLBuilder) WriteLimit(n int) error { |
| 239 | if b.state != writeSelOrDel && b.state != writeWhere && b.state != writeOrderBy { |
| 240 | return errors.Errorf("invalid state: %v", b.state) |
| 241 | } |
| 242 | b.state = writeLimit |
| 243 | b.restoreCtx.WritePlain(" LIMIT ") |
| 244 | b.restoreCtx.WritePlain(strconv.Itoa(n)) |
| 245 | return nil |
| 246 | } |
| 247 | |
| 248 | func (b *SQLBuilder) writeTblName() error { |
| 249 | tn := ast.TableName{Schema: b.tbl.Schema, Name: b.tbl.Name} |