Comments (5)
Thanks @zhiburt!
I did a little investigation into psql's formatting:
postgres=# insert into test values (0, 'this is a short string
postgres'# with a newline', 'a really really really really really really really really really really really really really really really really really really really really really really really really really long string');
INSERT 0 1
postgres=# select * from test;
-[ RECORD 1 ]-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
a | 0
b | this is a short string +
| with a newline
c | a really really really really really really really really really really really really really really really really really really really really really really really really really long string
So it looks like psql follows your second example 🙂
Edit: just saw your new comment, that looks ace! I can think of a couple of potentially useful customizations:
- removing the quotes around each field (perhaps that should just be the default behaviour, to match psql?)
- setting the max width for the second column
- configuring whether the second column should wrap if it exceeds the max width, rather than truncating
Actually for 3. I was about to create a separate issue to enable wrapping in the default Table
layout - I'll do that separately.
So cool that you got this done so quickly!
from tabled.
Hi @sd2k,
thank you for making this proposal.
I think it might be useful.
I'll try to work on this.
One question got to my mind though:
what happens if a value is multiline string?
There could be used {:?}
to have a one line with escaped symbols.
-[ RECORD 1 ]-
first | "Hello\nWorld"
Or we could expand |
rows like this.
-[ RECORD 1 ]-
first | Hello
| World
from tabled.
I've updated #21 so it now has a methods for max width.
But I started to feel that maybe its too much of customization :( as we do a couple of allocation because of this.
Are you satisfied with how it looks?
The names of methods a bit worry me 😞
from tabled.
Please take a look at example
And is there any modificators I should add for such a type? Like custom width, custom space, a way to put a custom RECORD name or something.
from tabled.
It turns out that the format isn't as plain.
There's a +
sign and the length of ------
in header pattern must be the same for all records.
All of this requires allocations which makes me sad 😞
from tabled.
Related Issues (20)
- Unicode width not being accounted for HOT 2
- Can it be integrated with leptos? Can you give an example? HOT 4
- Add per column alignment setting for `ColumnNames`
- Typo in lib.rs line 72 - "almoust" should be "almost" HOT 1
- Is there any way to cut short long row entries HOT 3
- reduce padding option?
- Possible way to set intersection to a different character for just one row/column? HOT 3
- Make all set functions for `Style` `const` HOT 1
- `table.is_empty()` on tables with only a header row HOT 3
- Question: Is there a way to conditionally apply a cell background color? HOT 5
- Impossible to call `Style::empty().remove_left()` HOT 8
- `Rotate::Bottom` must reorder rows?
- Refactor `Builder` methods HOT 17
- Add a indent size
- Does not build on MacOS HOT 4
- Add a benchmark to compare against a basic tabulation HOT 1
- Why the left/right border does not have intersection `CompactTable`
- Impl `Dimension` for Vec<usize>
- Add a `skip` function to `CompactTable`
- Create a iterative interface to `CompactTable`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tabled.