bug-recutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-recutils] Auto generated fields


From: OLLIER Jean-François
Subject: Re: [bug-recutils] Auto generated fields
Date: Sun, 30 Jan 2011 22:31:10 +0100
User-agent: Mutt/1.4.2.2i

I feel that the auto date will make a hit!

Jean-François

On Sun, Jan 30, 2011 at 09:26:05PM +0100, Jose E. Marchesi wrote:
> 
> Hi.
> 
> I just merged a branch providing support for auto-generated fields.
> They are a way to for example implement auto-counters and timestamps.
> 
> A new directive is available for use in record descriptor: %auto.  It
> accepts a list of fields separated by blanks, and determines that those
> fields shall be auto-generated when new records are inserted in the
> record set.
> 
> For example, consider:
> 
> /
> | %rec: Item
> | %type: Id int
> | %auto: Id
> | 
> | Id: 1
> | Description: this is item 1
> \
> 
> If a new item is inserted using recins, and no explicit Id is specified:
> 
>  $ recins -t Item -f Description -v "another item" items.rec
> 
> The newly created record will contain a unique Id:
> 
> /
> | %rec: Item
> | %type: Id int
> | %auto: Id
> | 
> | Id: 1
> | Description: this is item 1
> |
> | Id: 2
> | Description: another item
> \
> 
> The auto-increment functionality works with fields of type 'int' and
> 'range'.
> 
> If %auto is used with fields of type 'date', the generated fields will
> contain the current date of the system at record creation.  This is
> useful to implement timestamps:
> 
> /
> | %rec: Item
> | %type: Id int
> | %type: Date date
> | %auto: Id Date
> |
> | Id: 1
> | Date: Sun Jan 30 21:24:28 CET 2011
> | Description: this is item 1
> \
> 
> Note that the auto-generation of the fields will be performed only if no
> explicit values are specified for those fields in the recins invocation.
> Aditionally, the --no-auto command line argument of recins can be used
> to inhibit the generation.
> 
> Enjoy!
> 
> -- 
> Jose E. Marchesi    address@hidden
> GNU Project         http://www.gnu.org

-- 
Jean-François OLLIER
mailto:address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]