Login
repo.s2 at [cdbcddb1a1]
Login

File bindings/s2/require.d/fsl/util/repo.s2 artifact a38b14d361 part of check-in cdbcddb1a1


/**
   In-progress set of utilities for working with repo db tables.
*/
requireS2(['fsl/db/repo'], proc(repo){
    return {
        db: repo,
        /**
           Fetches an array of strings from this.db, each one being
           the name of a user in the current repository. They are
           sorted by name.
        */
        getUserList: proc(){
            return this.db.selectValues('select login from user order by login');
        },

        /**
           Returns the value of the repoDb.config field with the given key,
           or undefined if no such row is found.
        */
        getConfig: proc(key){
            affirm 'string' === typename key /* expecting a legal repo.config.key value */;
            return this.db.selectValue('SELECT value FROM config WHERE name=?',key);
        }
    };
});