本文整理匯總了Golang中github.com/gummiboll/forgetful/storage.Impl.RemoveExpiredNotes方法的典型用法代碼示例。如果您正苦於以下問題:Golang Impl.RemoveExpiredNotes方法的具體用法?Golang Impl.RemoveExpiredNotes怎麽用?Golang Impl.RemoveExpiredNotes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/gummiboll/forgetful/storage.Impl
的用法示例。
在下文中一共展示了Impl.RemoveExpiredNotes方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: main
func main() {
// Init
i := storage.Impl{}
if err := i.InitDB(); err != nil {
panic(err)
}
i.InitSchema()
if err := i.RemoveExpiredNotes(); err != nil {
panic(err)
}
app := cli.NewApp()
app.Name = "forgetful"
app.Usage = "For your notes/cheat sheets"
app.Version = version
app.Commands = []cli.Command{
{
Name: "add",
Aliases: []string{"a"},
Usage: "Add a note",
Flags: []cli.Flag{
cli.BoolFlag{
Name: "t",
Usage: "Mark as temporary (expires after 24 hours)",
},
cli.BoolFlag{
Name: "p",
Usage: "Create note with contents from clipboard",
},
},
Action: func(c *cli.Context) error {
n, err := commands.AddCommand(c, i)
if err != nil {
return err
}
fmt.Println(fmt.Sprintf("Added note: %s", n.Name))
return nil
},
},
{
Name: "delete",
Aliases: []string{"d"},
Usage: "Delete a note",
Action: func(c *cli.Context) error {
n, err := commands.DeleteCommand(c, i)
if err != nil {
return err
}
fmt.Println(fmt.Sprintf("Deleted note: %s", n.Name))
return nil
},
},
{
Name: "edit",
Aliases: []string{"e"},
Usage: "Edit/read a note",
Action: func(c *cli.Context) error {
n, err := commands.EditCommand(c, i)
if err != nil {
return err
}
fmt.Println(fmt.Sprintf("Updated note: %s", n.Name))
return nil
},
},
{
Name: "info",
Aliases: []string{"i"},
Usage: "Prints information about a note",
Action: func(c *cli.Context) error {
n, err := commands.InfoCommand(c, i)
if err != nil {
return err
}
printInfo(n)
return nil
},
},
{
Name: "read",
Aliases: []string{"r"},
Usage: "Read a note",
Action: func(c *cli.Context) error {
if err := commands.ReadCommand(c, i); err != nil {
return err
}
return nil
},
},
{
Name: "rename",
Aliases: []string{"mv"},
Usage: "Rename a note",
Action: func(c *cli.Context) error {
//.........這裏部分代碼省略.........