add command impl

This commit is contained in:
Jay 2019-09-17 13:56:27 +00:00
parent f438be5771
commit 290f5ce85b

View File

@ -32,7 +32,7 @@ func (c *CommandImpl) Delete(key string, platform string, binding string) error
sq.Eq{"key": key},
sq.Eq{"platform": platform},
sq.Eq{"binding": binding},
})
}).ToSql()
if err != nil {
return err
}
@ -44,22 +44,100 @@ func (c *CommandImpl) Delete(key string, platform string, binding string) error
return nil
}
// GetByKey -
func (c *CommandImpl) GetByKey(key string) ([]pubmodel.Command, error) {
panic("not implemented")
query, args, err := sq.Select("key", "platform", "binding", "require_manage", "require_init", "value", "ctime", "mtime").
From(`"public"."command"`).Where(sq.Eq{"key": key}).ToSql()
if err != nil {
return nil, err
}
query = x.Rebind(query)
list := make([]pubmodel.Command, 0)
err = x.Select(&list, query, args...)
if err != nil {
return nil, err
}
return list, nil
}
// GetByKeyPlatform -
func (c *CommandImpl) GetByKeyPlatform(key string, platform string) ([]pubmodel.Command, error) {
panic("not implemented")
query, args, err := sq.Select("key", "platform", "binding", "require_manage", "require_init", "value", "ctime", "mtime").
From(`"public"."command"`).Where(sq.And{
sq.Eq{"key": key},
sq.Eq{"platform": platform},
}).ToSql()
if err != nil {
return nil, err
}
query = x.Rebind(query)
list := make([]pubmodel.Command, 0)
err = x.Select(&list, query, args...)
if err != nil {
return nil, err
}
return list, nil
}
// GetByKeyPlatformBinding -
func (c *CommandImpl) GetByKeyPlatformBinding(key string, platform string, binding string) ([]pubmodel.Command, error) {
panic("not implemented")
query, args, err := sq.Select("key", "platform", "binding", "require_manage", "require_init", "value", "ctime", "mtime").
From(`"public"."command"`).Where(sq.And{
sq.Eq{"key": key},
sq.Eq{"platform": platform},
sq.Eq{"binding": binding},
}).ToSql()
if err != nil {
return nil, err
}
query = x.Rebind(query)
list := make([]pubmodel.Command, 0)
err = x.Select(&list, query, args...)
if err != nil {
return nil, err
}
return list, nil
}
// GetByPlatformBinding -
func (c *CommandImpl) GetByPlatformBinding(platform string, binding string) ([]pubmodel.Command, error) {
panic("not implemented")
query, args, err := sq.Select("key", "platform", "binding", "require_manage", "require_init", "value", "ctime", "mtime").
From(`"public"."command"`).Where(sq.And{
sq.Eq{"platform": platform},
sq.Eq{"binding": binding},
}).ToSql()
if err != nil {
return nil, err
}
query = x.Rebind(query)
list := make([]pubmodel.Command, 0)
err = x.Select(&list, query, args...)
if err != nil {
return nil, err
}
return list, nil
}
// GetByKeyBinding -
func (c *CommandImpl) GetByKeyBinding(key string, binding string) ([]pubmodel.Command, error) {
panic("not implemented")
query, args, err := sq.Select("key", "platform", "binding", "require_manage", "require_init", "value", "ctime", "mtime").
From(`"public"."command"`).Where(sq.And{
sq.Eq{"key": key},
sq.Eq{"binding": binding},
}).ToSql()
if err != nil {
return nil, err
}
query = x.Rebind(query)
list := make([]pubmodel.Command, 0)
err = x.Select(&list, query, args...)
if err != nil {
return nil, err
}
return list, nil
}