Skip to content
Snippets Groups Projects
files.go 1.47 KiB
Newer Older
  • Learn to ignore specific revisions
  • Christian Pointner's avatar
    Christian Pointner committed
    //
    //  tank
    //
    //  Import and Playlist Daemon for autoradio project
    //
    //
    
    //  Copyright (C) 2017-2018 Christian Pointner <equinox@helsinki.at>
    
    Christian Pointner's avatar
    Christian Pointner committed
    //
    //  This file is part of tank.
    //
    //  tank is free software: you can redistribute it and/or modify
    //  it under the terms of the GNU General Public License as published by
    //  the Free Software Foundation, either version 3 of the License, or
    //  any later version.
    //
    //  tank is distributed in the hope that it will be useful,
    //  but WITHOUT ANY WARRANTY; without even the implied warranty of
    //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    //  GNU General Public License for more details.
    //
    //  You should have received a copy of the GNU General Public License
    //  along with tank. If not, see <http://www.gnu.org/licenses/>.
    //
    
    package store
    
    
    Christian Pointner's avatar
    Christian Pointner committed
    func (st *Store) ListFiles(group string) (files Files, err error) {
    
    Christian Pointner's avatar
    Christian Pointner committed
    	err = st.db.Model(&Group{Name: group}).Related(&files).Error
    
    func (st *Store) CreateFile(group string, file File) (id uint64, err error) {
    
    Christian Pointner's avatar
    Christian Pointner committed
    	// TODO: implement this
    	return 0, ErrNotImplented
    
    func (st *Store) GetFile(group string, id uint64) (file File, err error) {
    
    Christian Pointner's avatar
    Christian Pointner committed
    	err = st.db.First(&file, id).Error
    
    func (st *Store) UpdateFile(group string, id uint64, file File) (err error) {
    
    Christian Pointner's avatar
    Christian Pointner committed
    	// TODO: implement this
    	return ErrNotImplented
    
    func (st *Store) DeleteFile(group string, id uint64) (err error) {
    
    Christian Pointner's avatar
    Christian Pointner committed
    	// TODO: remove file from directory (using callback??)
    	return st.db.Delete(&File{ID: id}).Error
    
    Christian Pointner's avatar
    Christian Pointner committed
    }